VMware Cloud Community
tdubb123
Expert
Expert
Jump to solution

restart hostd and vpxa

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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
7 Replies
UmeshAhuja
Commander
Commander
Jump to solution

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.
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

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

}

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

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?

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

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

Thanks

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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


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

Reply
0 Kudos
tdubb123
Expert
Expert
Jump to solution

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

Reply
0 Kudos