Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - Bug? Shouldn't Stop-Process automatically match Id if object is a process?

Reply
 
Old 06-20-2006   #1 (permalink)
Alex K. Angelopoulos [MVP]
Guest


 
 

Bug? Shouldn't Stop-Process automatically match Id if object is a process?

Although you can pipe a process into Stop-Process, or specify it as an
InputObject value, if you supply the process as a default value, it fails
abysmally. For example:

PS> calc;$calc = gps -Name calc
PS> spps -InputObject $calc
PS> calc;$calc = gps -Name calc
PS> spps $calc
Stop-Process : Cannot bind parameter 'Id'. Cannot convert "System.Diag
nostics.Process (calc)" to "System.Int32".
At line:1 char:5
+ spps <<<< $calc

Obviously this is because a System.Diagnostics.Process is not an Int32.
Almost as obviously, if we could do this, it would in some ways make the
InputObject not very useful and could arguably blur the distinction of Id.

Still, if someone is specifying a process reference, it very clearly is a
uniquely identified process which has an Id that can be determined.
Therefore, it should be possible to for that special case simply resolve the
item to an Id. Is this possible to do without making the Id surfacing too
complex? And if so, is there a reason why it might be harmful to allow?



My System SpecsSystem Spec
Old 06-20-2006   #2 (permalink)
dreeschkind
Guest


 
 

RE: Bug? Shouldn't Stop-Process automatically match Id if object is a

"Alex K. Angelopoulos [MVP]" wrote:

> Although you can pipe a process into Stop-Process, or specify it as an
> InputObject value, if you supply the process as a default value, it fails
> abysmally. For example:
>
> PS> calc;$calc = gps -Name calc
> PS> spps -InputObject $calc
> PS> calc;$calc = gps -Name calc
> PS> spps $calc
> Stop-Process : Cannot bind parameter 'Id'. Cannot convert "System.Diag
> nostics.Process (calc)" to "System.Int32".
> At line:1 char:5
> + spps <<<< $calc



Interesting, I would expect this to work.
Isn't this similar to e.g. the remove-item cmdlet?
Remove-Item accepts path names (Strings) and objects references
(System.IO.FileInfo). I think Stop-Process cmdlet should then support process
Id (Int32) and object references (System.Diagnostics.Process), too.

--
greetings
dreeschkind
My System SpecsSystem Spec
Old 06-20-2006   #3 (permalink)
Keith Hill [MVP]
Guest


 
 

Re: Bug? Shouldn't Stop-Process automatically match Id if object is a

"dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message
news:1EA3B494-3BCC-431A-80F2-36F49752E29D@microsoft.com...
> Interesting, I would expect this to work.
> Isn't this similar to e.g. the remove-item cmdlet?
> Remove-Item accepts path names (Strings) and objects references
> (System.IO.FileInfo). I think Stop-Process cmdlet should then support
> process
> Id (Int32) and object references (System.Diagnostics.Process), too.


Yeah, you would think that Stop-Process would recognize and understand how
to stop a process described by a System.Diagnostics.Process object. Submit
it and I'll vote on it.

--
Keith


My System SpecsSystem Spec
Old 06-21-2006   #4 (permalink)
Alex K. Angelopoulos [MVP]
Guest


 
 

Re: Bug? Shouldn't Stop-Process automatically match Id if object is a

Alright guys - here it is:
https://connect.microsoft.com/feedba...1919&SiteID=99

"Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote in
message news:e0T0AVNlGHA.3816@TK2MSFTNGP02.phx.gbl...
> "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message
> news:1EA3B494-3BCC-431A-80F2-36F49752E29D@microsoft.com...
>> Interesting, I would expect this to work.
>> Isn't this similar to e.g. the remove-item cmdlet?
>> Remove-Item accepts path names (Strings) and objects references
>> (System.IO.FileInfo). I think Stop-Process cmdlet should then support
>> process
>> Id (Int32) and object references (System.Diagnostics.Process), too.

>
> Yeah, you would think that Stop-Process would recognize and understand how
> to stop a process described by a System.Diagnostics.Process object.
> Submit it and I'll vote on it.
>
> --
> Keith
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Process automatically switching to Low Priority General Discussion
Problem with Measure-Object on get-process PowerShell
New-object preventing process from exiting PowerShell
get-process & stop-process by owner PowerShell
measure-object {get-process} PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46