http://communities.vmware.com/thread/199361
The thread above works well to pull all the esx hosts logs files.
I have a situtaion where i need to update all the ESX.CONF file on about 50 hosts over two clusters...
Get-Datacenter <datacenter-name> | Get-VMHost | %{
# Place host in maintenance mode
$_ | Set-VMHost -State Maintenance
# Execute the esxcfg-module command
$User = <ESX-account>
$Pswd = <ESX-account-password>
$Computer = $_.Name
$plink = "D:\UserData\Tools\Putty\plink.exe"
$cmd1 = 'sudo -u root /usr/sbin/esxcfg-module -s "qlink_down_timeout=30 qlport_down_retry=255 qlogin_retry_count=255 ql2maxqdepth=32" qla2300_707'
$filename = "temp.txt"
$cmd1 | Set-Content $filename
$plinkoptions = " -v -pw $Pswd -m $filename"
$command = $plink + " " + $plinkoptions + " " + $User + "@" + $computer
Invoke-Expression -command $command
# Reboot the server
$taskMoRef = ($_ | Get-View).ShutdownHost_Task($true)
$task = Get-View $taskMoRef
while ($task.Info.State -eq "running" -or $task.Info.State -eq "queued") {$task = Get-View $taskMoRef}
# Place host in connected mode
$_ | Set-VMHost -State Connected
}
Online access to the latest VMworld Sessions & Labs and online services.
Learn morePurchase credits to redeem training and consulting services online.
Buy Now