jravnsba1
Contributor
Contributor

Stop SSH not working if select property is specified ?

I'm unable to figure out why this script only works when no select property are specified.

This doesn't work

Get-VMHost|Get-VMHostService|where {$_.Key -eq 'TSM-SSH' -and $_.Running} |select vmhost, label, running|ogv -PassThru -title "Select ESX where SSH should be stopped"|Stop-VMHostService -confirm:$false

This works but the view doesn't contain hostnames :disappointed_face:

Get-VMHost|Get-VMHostService|where {$_.Key -eq 'TSM-SSH' -and $_.Running} |ogv -PassThru -title "Select ESX where SSH should be stopped"|Stop-VMHostService -confirm:$false

Any help appreciated

Joern Ravnsbaek
Tags (1)