Enable SSH across all vmHosts

I had the need to enable SSH on all my hosts to make configuration changes.  Instead of manually going to each host and enabling the service I searched for a powercli command.  I was able to find the following little snipit – and it did exactly what I wanted

Get-VMHost | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} | Start-VMHostService

This rolled through each host in the cluster and turned on the service.

When I was done I changed start to stop and turned off SSH across all the hosts.

 

Advertisements

Determine ESXi / ESX host versions

How often are you looking to see if all your ESX hosts are at the same revision level?  Did one get left behind, or did someone run odd updates against one and you are trying to figure out the out one out?

This is very easy to find via PowerCLI.  Once you are authenticated to one or many vcenter instances (connect-viserver) you can run one of the following commands – it really depends how much data you want to capture.

getview ViewType HostSystem -Property Name,Config.Product | select Name,{$_.Config.Product.FullName}
This will give you output similar to:
Name $_.Config.Product.FullName
—- ————————–
mnepesx35p.corporate.ltcg.com VMware ESXi 6.0.0 build-3825889
mnepesx22-p.corporate.ltcg.com VMware ESXi 6.0.0 build-3825889

or

getview ViewType HostSystem -Property Name,Config.Product | foreach {$_.Name, $_.Config.Product}
This will give you output similar to:
Name : VMware ESXi
FullName : VMware ESXi 6.0.0 build-3825889
Vendor : VMware, Inc.
Version : 6.0.0
Build : 3825889
LocaleVersion : INTL
LocaleBuild : 000
OsType : vmnix-x86
ProductLineId : embeddedEsx
ApiType : HostAgent
ApiVersion : 6.0
InstanceUuid :
LicenseProductName : VMware ESX Server
LicenseProductVersion : 6.0

Both could be tagged with a >filename at the end if you wish to save to a file versus output to the console screen.

 



Credit to vmdev.info’s post found here.