Wednesday 13 December 2017

Suppress ESXi SSH and Shell Warning

By default whenever I build a new ESXi host I tend to enable both SSH and ESXi Shell so that I can troubleshoot my ESXi server via SSH or shell on the console itself if I need to.
As soon as you enable either one of them you will start to get these messages within the web client or vSphere C# client
The host health also changes to give you a heath warning to tell you that it has detected some issues and it is understandable that is should alert you if SSH or Shell access has been enabled.

The manual way to change this is either to selec the "suppress warning" on the error message to disable the warning or via the web client to set the value. First you select the host then go to "Manage > Settings > Advanced System Settings". From there look for "UserVars.SuppressShellWarning" and change the value from "0" to "1".


But as I have already scripted most of my host build I wanted my script to also change this value so that 1) we don't get this warning any more, 2) If I see a warning message on my host after a new build then I know it is something else that is not right on the host.

I am assuming you have powercli installed and also the script is connecting to a single host

#### Variables ####
$ESXHost = "Your ESXi Host Name or IP Address Here" #Put your ESXi host name or IP address
###################
#Connect to your ESX Host
Connect-viserver $ESXHost
#Get the current setting
Get-VMhost $ESXHost | Get-AdvancedSetting - Name UserVars.SuppressShellWarning 
#Set the value to 1 and suppress confirmation of running this command
Get-VMhost $ESXHost | Get-AdvancedSetting - Name UserVars.SuppressShellWarning | Set-AdvancedSetting -Value 1 -Confirm:$False
#Show the setting
Get-VMhost $ESXHost | Get-AdvancedSetting - Name UserVars.SuppressShellWarning 

The script is here too https://github.com/myvmx/myvmx/blob/master/VMware/SuppressShellWarning.ps1

No comments:

Post a Comment

New Azure KMS IP and domain Addresses for activation

For Windows virtual machines deployed into Azure using marketplace images you may have created rules in your NSG or firewalls to allow the s...