# 登录vCenter Server
Connect-VIServer -Server <vCenter IP> -user Administrator@vsphere.local -password <密码>
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
# 查看SSH服务状态
$VMHost = Get-VMHost
foreach ($VMHost in $VMHost) {
Get-VMHostService -VMHost $VMHost | where {$_.Key -eq "TSM-SSH"} | Select @{N="VMHost";E={$VMHost.Name}},Key,Running
}
# 关闭SSH服务
$VMHost = Get-VMHost
foreach ($VMHost in $VMHost) {
Get-VMHostService -VMHost $VMHost | where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService -Confirm:$false
}
文章评论