Skip to main content

Posts

Showing posts from September, 2016

When the Cmdlet is Bad

This is post 7 of 7 in this series. Take a look at this code and ask yourself “Will I be able to list all services running on all clients in my domain?” PS C:\> "DC1", "SVR1", "SVR2" | Get-Service Well, let’s take a look at the help file for Get-Service and see is any parameters accept pipeline input ByValue. I shortened the list to the only two parameters that do. Get-Help Get-Service -Parameter * -InputObject [ ]     Specifies ServiceController objects representing the services to be retrieved. Enter a     variable that contains the objects, or type a command or expression that gets the     objects. You can also pipe a service object to this cmdlet.         Required?                    false     Position?                    named     Default value                none     Accept pipeline input?       true (ByValue)     Accept wildcard characters?  false     -Name [ ]     Specifies the service names of ser