how do I restart hostd and vpxa on a host with powercli? do I need plink or somrthing?
You can not restart the host service with the Restart-VMHostService cmdlet.
You'll have to do this from a SSH session to the ESXi node (see KB1003490).
You can use plink.exe from the PuTTY Suite to do this (provided SSH is allowed).
There are many example on the use of plink.exe available in this community.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
Try something like this
Get-VMHostService -VMHost MyEsx |
where {$_.Key -eq "vpxa"} |
Restart-VMHostService -Confirm:$false -ErrorAction SilentlyContinue
You can not restart the host service with the Restart-VMHostService cmdlet.
You'll have to do this from a SSH session to the ESXi node (see KB1003490).
You can use plink.exe from the PuTTY Suite to do this (provided SSH is allowed).
There are many example on the use of plink.exe available in this community.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
hi
this is what I have, looks like the parameters got set and host d got restarted but I got errors
$esxhosts = get-cluster -Name "cluster" | Get-VMHost xxxxxx
foreach ($vmhost in $esxhosts) {
$esxcli = Get-EsxCli -VMHost $vmhost
$iscsihba = get-vmhost -Name $vmhost | get-vmhosthba | ? {$_.Type -eq "IScsi"}
$esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'LoginTimeout','60')
$esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'RecoveryTimeout','30')
$esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'NoopOutTimeout','30')
$esxcli.iscsi.adapter.param.set($iscsihba.device,$false,'NoopOutInterval','30')
plink 'c:\scripts\plink.exe' $vmhost 'root' 'xxxxx' '/etc/init.d/vpxa restart'
plink 'c:\scripts\plink.exe' $vmhost 'root' 'xxxxx '/etc/init.d/hostd restart'
start-sleep 10
}
Hi I think it worked. when I ran it again. I want to do rolling restart of vpxa and hostd without all the hosts going into a disconnected state, what would be a good wait time between restarting of vpxa and hostd on each host?
start-sleep 10?
I just tried it with start-sleep 20 and seems to work fine.
Thanks
You mean a Start-Sleep between the 2 plink commands?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes. the interval. i want to avoid all hosts in a disconnected state when restarting these agents