Is this a bug? Start-Service | stop-Service


hello,

i ran interesting problem when stopping service on remote computer. 

get-service -name healthservice     # returns local healthservice, happily running    get-service -name healthservice -computername othercomputer    #this returns remote service running    get-service -name healthservice -computername othercomputer | stop-service    #this doesn't return errors    get-service -name healthservice -computername othercomputer    # returns remote service still listed running    get-service -name healthservice    #this returns local healthservice stopped  

what heck!?!  do have use wmi correctly?  and why stop service kill local health service? feels connect bug in making...


hope helps! jason

yes, you'd need wmi.

stop-service not have computername parameter (even in v3)

try this:

$wmiobject = @{     class = "win32_service"     computername = $computer     filter = "name='healthservice'" } (get-wmiobject @wmiobject).stopservice() |out-null

karl

when see answers , helpful posts, please click vote helpful, propose answer, and/or mark answer



blog: http://unlockpowershell.wordpress.com
book: windows powershell 2.0 bible
e-mail: -join ("6b61726c6d69747363686b65406d742e6e6574"-split"(?<=\g.{2})",19|%{[char][int]"0x$_"})



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file