VMware Cloud Community
Atif_YNI
Enthusiast
Enthusiast
Jump to solution

Enable and set ESXi shell timeout

I am looking for a script for set the value of UserVars.ESXiShellTimeout on all our hosts to 3600.

I am not great with scripts and have searched the internet. Now I am looking for help with it from the great minds here.

Atif

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VMHost | 
Get-AdvancedSetting -Name "UserVars.ESXiShellTimeOut" | 
Set-AdvancedSetting -Value "3600" -Confirm:$false

Watch out with the spelling of the name, it is case sensitive 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VMHost | 
Get-AdvancedSetting -Name "UserVars.ESXiShellTimeOut" | 
Set-AdvancedSetting -Value "3600" -Confirm:$false

Watch out with the spelling of the name, it is case sensitive 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Atif_YNI
Enthusiast
Enthusiast
Jump to solution

My King!!! thank you.

Would this do this for all ESXi hosts in a vCenter? If not, can we incorporate a spreadsheet with host names?

Tags (1)
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, as you requested, this is for all ESXi nodes in your vCenter.

If you want to read a set of names from a CSV for example, you do something like this.
The CSV contains a column with the name EsxiName.

 

$names = Import-Csv -Path .\esxinames.csv -UseCulture | 
    Select-Object -ExpandProperty EsxiName

Get-VMHost -Name $names  | 
Get-AdvancedSetting -Name "Uservars.ESXiShelltimeout" | 
Set-AdvancedSetting -Value "900" -Confirm:$false

 

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Atif_YNI
Enthusiast
Enthusiast
Jump to solution

Completed 100 hosts in 3 minutes.

 

Thank you LucD!!!

Tags (1)
0 Kudos