Virtu-Al.Net

Virtually everything is poshable

Enabling ESX SSH via PowerCLI

Ok, I have been living under a rock a little recently, I have had so much going on that my blog and my hands on time has been suffering, sorry for that.

Whilst delivering a presentation on the new features in vSphere 4.1 – Of which there are tons (should have been 4.5 in my opinion), I came across the ability to be able to enable SSH from the DCUI (Direct Console User Interface).

image

This has also been made available as a service in vCenter now where they can be remotely started and stopped….

image

OK, so this is probably not new news for the people who have had time to play with 4.1 but the cool thing is that that this is now also available via PowerCLI too, we can see this if we retrieve the VMHost and then run a Get-VMHostService on it….

image

This is great news, so now if we needed to we could start the SSH service for each of our hosts with just a simple piece of code:

Get-VMHost | Foreach {
  Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} )
}

We can also do this for any of the other services in the list including restarting the vCenter Agent – Now that’s a cool new feature in 4.1 !

We can also list all of our hosts and see if the service is running using the following one-liner:

Get-VMHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } |select VMHost, Label, Running

, , ,

13 Responses to “Enabling ESX SSH via PowerCLI”

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>