I would like to create one liner where I can (somehow) pass computer name down the pipeline.
This will be useful when I have a list with computers that will return me value.
Example:
“Get-Service -computername localhost” will return
Status Name DisplayName
What I’m aiming is to have one more column:
Computer Status Name DisplayName
Can you advice me, how to get that?
I’ve tied with -pipelinevariable parameter, but didn’t get any success.
That’s difficult in a one-liner, because the object produced by Get-Service doesn’t contain that information. Ergo, it doesn’t exist in the pipeline. You can’t “pass data through a command;” the pipeline can only contain what the most recent command ran.
You can accomplish what you want, but not with a one-liner. Why is a one-liner a fixed goal for you?
Thank you Curtis (that’s for you > https://beeroverip.org/ ), however I now realize that what I want is not possible as the data do not exist.
I wanted to run is the command bellow:
Get-VirtualSwitch -VMHost (get-content c:\hosts.txt) | where {name -like ‘Cluster1_*’}
It will return only names of the filtered Switch, but not which host have it. So nothing major, but still not something that should deserves to be write in ISE (which will load the vmware snapin/module for a lot of time).