The command below will enable Tec Support Mode (SSH) in one host
Set-VMHostService -HostService (Get-VMHostService -VMHost hostname | where {$_.key -eq “TSM-SSH”}) -Policy “Automatic”
How can you enable TSM for multiple hosts
Can't you do this in a pipeline construction like this ?
Get-VMHost | Get-VMHostService | where {$_.key -eq “TSM-SSH”} | Set-VMHostService -Policy “Automatic”
And then you select the hosts you want with another Where-Object after the Get-VMHost.
Get-VMHost | where{$_.Name -like "Srv1*"} | Get-VMHostService | where {$_.key -eq “TSM-SSH”} | Set-VMHostService -Policy “Automatic”
This should change the service for all hosts whose name starts with "Srv1"
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Can't you do this in a pipeline construction like this ?
Get-VMHost | Get-VMHostService | where {$_.key -eq “TSM-SSH”} | Set-VMHostService -Policy “Automatic”
And then you select the hosts you want with another Where-Object after the Get-VMHost.
Get-VMHost | where{$_.Name -like "Srv1*"} | Get-VMHostService | where {$_.key -eq “TSM-SSH”} | Set-VMHostService -Policy “Automatic”
This should change the service for all hosts whose name starts with "Srv1"
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Never mind
$VMhosts = Get-Cluster | Get-VMhost
foreach ($VMhost in $VMhosts)
{
Set-VMHostService -HostService (Get-VMHostService -VMHost $VMhost | where {$_.key -eq “TSM-SSH” -and $._Policy -eq "off"}) -Policy “Automatic”
}
