I am using this powershell script to restart my vCenter Agent on my ESXi server
connect-viserver -server "vCenter Server"
$vmhost = "My Host"
Get-VmHostService -VMHost $vmhost | Where-Object {$_.key -eq "vpxa"} | Restart-VMHostService
but... It doesn't fully restart the agent, right after i run it the ESXi server goes no responding in vCenter and I get this error in PowerShell
anyone have luck with getting this script or a script like it to run.
Thanks,
Joe.
thread moved from VMware ESXi 5 to VMware vSphere™ PowerCLI
Having the same issue using PowerShell 3, PowerCLI 5.5 Release 2 Patch 1 build 1931983, connection to vCenter 5.5.0, 1750787 and ESXi host version 5.5.0, 1881737
Here is what I've tried for restarting the CIM Server services:
Get-VMHost -name myhost.mydomain.local | Get-VMHostService | where {$_.Key -match "sfcbd-watchdog"} | Restart-VMHostService -Confirm:$false
$svc = Get-VMHost -name myhost.mydomain.local | Get-VMHostService | where {$_.Key -match "sfcbd-watchdog"}
Stop-VMHostService $svc -Confirm:$false
$svc = Get-VMHost -name myhost.mydomain.local | Get-VMHostService | where {$_.Key -match "sfcbd-watchdog"}
Start-VMHostService $svc -Confirm:$false
Sometimes one of the above options work for some hosts and not for others or not at all. However for ALL hosts I can successfully Stop/Start/Restart the same service (CIM Server) using the VI Client.
The output error I get is:
Stop-VMHostService : 8/21/2014 10:33:16 AM | Stop-VMHostService | A general system error occurred: Invalid fault |
At line:24 char:1
+ Stop-VMHostService $svc -Confirm:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo | : NotSpecified: (:) [Stop-VMHostService], SystemError | |
+ FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_SetVMHostService_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.StopVMHostService |
Restart-VMHostService : 8/21/2014 11:00:07 AM | Restart-VMHostService | A general system error occurred: Invalid fault |
At line:28 char:94
+ ... d-watchdog"} | Restart-VMHostService -Confirm:$false
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo | : NotSpecified: (:) [Restart-VMHostService], SystemError | |
+ FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_SetVMHostService_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.RestartVMHostService |
Have a look at a previous post
PowerCLI command to restart management agents on an ESXi 5.1 host
Supress error message with:
Get-VmHostService -VMHost $vmhost | Where-Object {$_.key -eq "vpxa"} | Restart-VMHostService -ErrorAction SilentlyContinue
Supress error message and confirmation
Get-VmHostService -VMHost $vmhost | Where-Object {$_.key -eq "vpxa"} | Restart-VMHostService -ErrorAction SilentlyContinue -confirm:$false
Thanks Wh33ly for the reply. I've seen that post but it does not apply here as I am not restarting the management agents which understandably would kick back an error. In my case, remote management of the host via PowerCLI is not related to the CIM Server service which could be shutdown indefinitely without lose of remote management capability. After further review I actually see in the syslog.log the CIM Server service (sfcbd-watchdog) timing out, terminating the process and then restarting the sfcbd-watchdog. Although not ideal, I suppose it's eventually performing the "restart" of the service even though I get the error.
2014-08-21T18:02:34Z sfcbd-watchdog: PID file /var/run/vmware/watchdog-sfcb.PID does not exist
2014-08-21T18:02:34Z sfcbd-watchdog: Terminating watchdog process with PID
2014-08-21T18:02:34Z sfcbd-watchdog: stopping sfcbd pid
2014-08-21T18:02:34Z sfcbd: Sending TERM signal to sfcbd
2014-08-21T18:02:34Z sfcbd: Sending TERM signal to sfcbd
2014-08-21T18:02:34Z sfcbd-watchdog: Sleeping for 20 seconds
2014-08-21T18:02:54Z sfcbd-watchdog: Providers have terminated, lets kill the sfcbd.
2014-08-21T18:02:54Z sfcbd: Stopping sfcbd
2014-08-21T18:02:54Z sfcbd-watchdog: Sleeping for 20 seconds
2014-08-21T18:03:01Z crond[35645]: crond: USER root pid 11941934 cmd /etc/cim/ibm/refresh.sh
2014-08-21T18:03:14Z sfcbd-watchdog: Providers have terminated, lets kill the sfcbd.
2014-08-21T18:03:14Z sfcbd-watchdog: Waited for 3 20 second intervals, SIGKILL next
2014-08-21T18:03:14Z sfcbd: Stopping sfcbd
2014-08-21T18:03:14Z sfcbd-watchdog: Watchdog active: interval 60 seconds, pid 11941993
2014-08-21T18:03:14Z sfcbd-watchdog: starting sfcbd
2014-08-21T18:03:15Z sfcbd: Starting sfcbd
2014-08-21T18:03:17Z sfcb-sfcb[11942295]: --- Log syslog level: 3
2014-08-21T18:03:22Z cimslp: --- Using /etc/sfcb/sfcb.cfg