HOW TO: Start, Stop, Restart services on VMware vSphere ESX server via PowerCLI

The service you will need to start or stop simultaneously on multiple servers is likely to be the SSH (TSM-SSH) service.

Here is how you do it with PowerShell / PowerCLI:

$vCenter = '' ; Name or IP address of your vCenter Server
$Cluster = 'Vblock cluster 1'; Name of the cluster
Connect-VIServer $vCenter
$Scope = Get-Cluster $Cluster | Get-VMHost
foreach ($ESXhost in $Scope){
Get-VMHost -name $ESXhost | Get-VMHostService | where {$_.key -eq 'TSM-SSH'} | Start-VMHostService -Confirm:$false
# Change the line above with the following:
# Start-VMHostService
# Stop-VMHostService
# Restart-VMHostService
Disconnect-VIServer -Server $vCenter -Confirm:$false

Should you need to start / stop or restart other services, just change the service key.

Here is the list of services:

Get-VMHost -name Name_or_IP_address_of_a_host | Get-VMHostService | Format-Table -AutoSize


Key            Label                                                           Policy Running Required
---            -----                                                           ------ ------- --------
DCUI           Direct Console UI                                               on     True    False   
TSM            ESXi Shell                                                      off    False   False   
TSM-SSH        SSH                                                             off    False   False   
lbtd           lbtd                                                            on     True    False   
lsassd         Local Security Authentication Server (Active Directory Service) off    False   False   
lwiod          I/O Redirector (Active Directory Service)                       off    False   False   
netlogond      Network Login Server (Active Directory Service)                 off    False   False   
ntpd           NTP Daemon                                                      on     True    False   
sfcbd-watchdog CIM Server                                                      on     True    False   
vmware-fdm     vSphere High Availability Agent                                 on     True    False   
vpxa           vpxa                                                            on     True    False

1 comment to HOW TO: Start, Stop, Restart services on VMware vSphere ESX server via PowerCLI

  • Romulo

    Thanks great examples

    helped me to check mgmt services in our host as below

    Get-VMHost | get-vmhostservice | ? { $_.Key -match “vmware-vpxa” } | select vmhost, key, label, running, policy, required| ft -AutoSize

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>