PowerCli

Change ESXi host advance settings using powershell

write-host “Fetching ESXi Clusters”

$mgmtcluster = get-cluster “cluster1” | get-vmhost
 $cloudcluster = get-cluster “cluster2” | get-vmhost

function esxiconfig(){
 write-host “Setting Sysloghost”
 Get-vmhost | Set-VMHostAdvancedConfiguration -NameValue @{‘Syslog.global.logHost’=’udp://10.1.1.10’}
 write-host “Setting ESXi Shell TImeout”
 Get-vmhost | Set-VMHostAdvancedConfiguration -NameValue @{‘UserVars.ESXiShellTimeOut’=’3600’}
 write-host “Setting ESXi Shell Interactive Timeout”
 Get-vmhost | Set-VMHostAdvancedConfiguration -NameValue @{‘UserVars.ESXiShellInteractiveTimeOut’=’3600’}
 write-host “Setting DataMover HardwareAcceleratedMove Value”
 Get-vmhost | Set-VMHostAdvancedConfiguration -NameValue @{‘DataMover.HardwareAcceleratedMove’=’1’}
 write-host “Setting DataMover HardwareAcceleratedInit Value”
 Get-vmhost | Set-VMHostAdvancedConfiguration -NameValue @{‘DataMover.HardwareAcceleratedInit’=’1’}
 }

function servicestart(){
 write-host “Starting lsassd Service”
 get-vmhost | Get-VMHostService | ?{$_.key -eq “lsassd”} | Start-VMHostService
 write-host “Starting lwiod Service”
 get-vmhost | Get-VMHostService | ?{$_.key -eq “lwiod”} | Start-VMHostService
 write-host “Starting netlogond Service”
 get-vmhost | Get-VMHostService | ?{$_.key -eq “netlogond”} | Start-VMHostService
 write-host “Starting lwiod Service”
 get-vmhost | Get-VMHostService | ?{$_.key -eq “lwiod”} | Start-VMHostService
 write-host “Starting tsm-ssh Service”
 get-vmhost | Get-VMHostService | ?{$_.key -eq “tsm-ssh”} | Start-VMHostService
 }

$mgmtcluster | foreach ($vmhost){
 esxiconfig
 servicestart
 break
 }
 $cloudcluster | foreach ($vmhost){
 esxiconfig
 servicestart
 break
 }
 Write-host “Completed setting advanced configuration”
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s