update
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
$VMHosts = Get-VMHost
|
||||
|
||||
#SSH Service Status
|
||||
$SSHServiceStatus = $VMHosts | Get-VMHostService | Where-Object Key -eq "TSM-SSH" | select VMhost,Key,Label,Running
|
||||
|
||||
#Disable SSH
|
||||
ForEach($item in ($SSHService | Where-Object Running -eq $true)){
|
||||
Get-VMHost $item.VMHost | Get-VMHostService | Where-Object Key -eq "TSM-SSH" | Stop-VMHostService
|
||||
}
|
||||
|
||||
|
||||
|
||||
#Lockdown status
|
||||
$LockdownStatus = $VMHosts | Select Name,@{n='LockdownMode';e={$_.ExtensionData.Config.LockdownMode}}
|
||||
|
||||
#Enable Lockdown
|
||||
ForEach($VMHost in ($LockdownStatus | Where-Object LockdownMode -eq "lockdownDisabled")){
|
||||
(Get-VMHost $VMHost.Name | Get-View).EnterLockdownMode()
|
||||
}
|
||||
Reference in New Issue
Block a user