Alright, I think I've figured it out, using the help files, but want confirmation. I'm looking at Stop-service, and its 3 parameter sets.
Stop-Service [-Exclude ] [-Force] [-Include ] [-PassThru] -DisplayName [-Confirm]
Stop-Service [-Name] [-Exclude ] [-Force] [-Include ] [-PassThru] [-Confirm]
The parameter name is optional. You can use "Name" or its alias, "ServiceName", or you can omit the parameter
In particular, I was (am?) baffled by the second parameter set. I couldn't figure out how the service to be stopped was sent into it. But looking closely, I did notice the Displayname way down the parameter set. So, the reason its listed so far back from the beginning is that its named, not positional? And it would never be used as part of a pipeline... though I would imagine that a parenthesized get-service could be used in the parameter to supply it with some display names....
Does all that even make sense? It seems like it would be the least used of the 3 parameter sets, off the top of my head.
I think the key here is that the neither the Exclude or the Include parameters accept pipeline input so if you pass a string representing the service's Display Name to Stop-Service the only parameter it can bind to will be DisplayName.
If Exclude or Include accepted input from the pipeline then the DisplayName parameter would have to be in position 0.
You must be logged in to reply to this topic.