In this blog, we will ensure an inactivity timeout is applied to our esx host.
Get-vmhost | Get-AdvancedSetting UserVars.ESXiShellInteractiveTimeOut
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
##################################################################### # Ensure idle ESXi shell and SSH sessions time out after 300 seconds or less # # Tested by Ash on 28 Oct # V1.0 ###################################################################### #Variables $vCenter = "sfo-m01-vc02.ash.local" $Cluster = "vSAN-Production" ### Start of Script # Load VMware Cmdlet and connect to vCenter Add-PSSnapin vmware.vimautomation.core connect-viserver -server $vCenter $VMHost = Get-Cluster -Name $Cluster | Get-VMhost # List UserVars.ESXiShellInteractiveTimeOut for each host ForEach ($VMhost in $Cluster){ Get-VMHost | Select Name, @{N="UserVars.ESXiShellInteractiveTimeOut";E={$_ | Get-AdvancedSetting UserVars.ESXiShellInteractiveTimeOut | Select -ExpandProperty Values}} } # pausing for user input pause # Set Remove UserVars.ESXiShellInteractiveTimeOut to 300 on all hosts ForEach ($VMhost in $Cluster){ Write-Host -ForegroundColor GREEN "Setting ESXiShellInteractiveTimeOut Policy on " -NoNewline Write-Host -ForegroundColor YELLOW "$VMhost" Get-VMHost | Get-AdvancedSetting -Name 'UserVars.ESXiShellInteractiveTimeOut' | Set-AdvancedSetting -Value "300" } ### End of Script |
(Visited 467 times, 1 visits today)