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

September 16, 2013 by jdg 1 Comment

Turn on/off SSH across all hosts

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]

Filed Under: VMware Tagged With: 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...

View My Blog Posts

Trackbacks

  1. The VirtAdmin SSH Tool for vSphere Clusters | VirtAdminThe VirtAdmin SSH Tool for vSphere Clusters - VirtAdmin says:
    March 20, 2014 at 8:52 am

    […] while back, I added this post with some PowerCLI one-liners to turn on and off SSH across a whole cluster. I got irritated […]

    Reply

Leave a Reply Cancel reply

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

Connect With Me

  • Email
  • Linkedin
  • RSS
  • Twitter

Recent Posts

  • The Hard Thing About Hard Things
  • Fixing iDRAC Viewers on Mac with Hazel
  • Why Does Body Fat Accumulate?
  • What is Body Fat?

2017 Reading Challenge

James has read 3 books toward their goal of 52 books.
hide
3 of 52 (5%)
view books

Copyright © 2018 · Generate Pro Theme on Genesis Framework · WordPress · Log in