• Skip to primary navigation
  • Skip to main content

jdgreen.io

The personal blog of James Green

  • Home
  • Technology
    • Announcements
    • Industry
    • Reviews/Guides
    • Tech Field Day
    • Interviews
  • Health
    • Food
    • Biohacking
    • Fitness
  • Faith
  • Book Notes
    • Business Books
    • Faith Books
    • Health Books
    • Technology Books
  • About
  • Show Search
Hide Search

Turn on/off SSH across all hosts

James Green · Sep 16, 2013 ·

If you’ve ever needed to SSH to each host in your environment to do some work, you know what a pain it can be to click over to the Security Profile tab and enable it for one host at a time. A much faster way to do this would be with a PowerCLI one-liner. Below are the commands to turn SSH on and off across all hosts. Hope it saves you a few clicks!

[code lang=”powershell”]#Start SSH for all hosts in vCenter
Get-VMHost | Foreach {
Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} )
}[/code] [code lang=”powershell”]#Stop SSH for all hosts in vCenter
Get-VMHost | Foreach {
Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} ) -Confirm:$false
}
[/code]

VMware powercli, ssh, vmware

James Green is an enterprise IT consultant, a product of an amazing IT community, and a partner in ActualTech Media. He is a serial vExpert designee and a passionate Tech Field Day delegate and supporter. » Read Full Bio...

James Green: View My Blog Posts

Copyright © 2023 · Monochrome Pro on Genesis Framework · WordPress · Log in

Posting....