header image

Archive for November, 2011

Why use the pipeline?

Posted by: | November 2, 2011 | 1 Comment |

In this post http://msmvps.com/blogs/richardsiddaway/archive/2011/10/31/multiple-value-query-in-wql.aspx I showed how to use Get-WmiObject, WQL and Invoke-WmiMethod to stop multiple services.  The code looks like this Get-WmiObject -Class Win32_Service -Filter "State=’Running’ AND Name LIKE ‘%BITS%’ OR Name LIKE ‘%WinRM%’" | Invoke-WmiMethod -Name StopService   i was asked why I didn’t use foreach – ie make the PowerShell code look […]

under: PowerShell and WMI

« Newer Posts