Highlighted
Expert
Expert

restart hostd and vpxa

Jump to solution

how do I restart hostd and vpxa on a host with powercli? do I need plink or somrthing?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
User Moderator
User Moderator

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

View solution in original post

0 Kudos
7 Replies
Highlighted
Commander
Commander

Hi,

Try something like this



Get-VMHostService -VMHost MyEsx |
where
{$_.Key -eq "vpxa"} |
Restart-VMHostService
-Confirm:
$false -ErrorAction SilentlyContinue

Thanks n Regards Umesh Ahuja If your query resolved then please consider awarding points by correct or helpful marking.
0 Kudos
Highlighted
User Moderator
User Moderator

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

View solution in original post

0 Kudos
Highlighted
Expert
Expert

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

}

0 Kudos
Highlighted
Expert
Expert

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?

0 Kudos
Highlighted
Expert
Expert

I just tried it with start-sleep 20 and seems to work fine.

Thanks

0 Kudos
Highlighted
User Moderator
User Moderator

You mean a Start-Sleep between the 2 plink commands?


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

0 Kudos
Highlighted
Expert
Expert

yes. the interval. i want to avoid all hosts in a disconnected state when restarting these agents

0 Kudos