Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hersey Cartwright vBrownBag – Tech Talk VMworld 2015 Managing SSH with PowerCLI.

Similar presentations


Presentation on theme: "Hersey Cartwright vBrownBag – Tech Talk VMworld 2015 Managing SSH with PowerCLI."— Presentation transcript:

1 Hersey Cartwright vBrownBag – Tech Talk VMworld 2015 Managing SSH with PowerCLI

2 VMware PowerCLI Documentation https://www.vmware.com/support/developer/PowerCLI/ https://www.vmware.com/support/developer/PowerCLI/ togglessh.ps1 PowerCLI to start|stop TSM-SSH Service on all ESXi hosts in vCenter Inventory https://github.com/herseyc/PowerCLI-Scripts/blob/master/togglessh.ps1 https://github.com/herseyc/PowerCLI-Scripts/blob/master/togglessh.ps1 Resouces

3 Start and Stop Services (TSM-SSH) Start-VMHostService and Stop-VMHostService Get/Set Policy - Policies: automatic, on, off Get-VMHostService and Set-VMHostService ESXi Firewall (sshServer) Get-EsxCli PowerCLI Cmdlets

4 Is SSH Running? Get-VMHost | Get-VMHostService | Where {$_.Key –eq “TSM-SSH”} Start SSH Service Get-VMHost | Get-VMHostService | Where {$_.Key –eq “TSM-SSH”} | Start-VMHostService Stop SSH Service Get-VMHost | Get-VMHostService | Where {$_.Key –eq “TSM-SSH”} | Stop-VMHostService SSH Service – TSM-SSH

5 Configure ESXi Firewall Rule for sshServer $esxcli = Get-VMHost | Get-EsxCli $esxcli.network.firewall.ruleset.allowedip.add("192.168.1.0/24", "sshServer") $esxcli.network.firewall.refresh() ESXi Firewall

6 PowerCLI to start|stop TSM-SSH Service on all ESXi hosts in vCenter Inventory Usage: togglessh.ps1 (start|stop) Example: togglessh.ps1 start Variables: $vcenter What it does… ▫ Connects to vCenter Server – Connect-VIServer $vcenter ▫ Gets all hosts in vCenter Inventory – $vmhosts = Get-VMHost ▫ Starts or Stops TSM-SSH Service on each host in vCenter Inventory foreach ($vmhost in $vmhosts)  Get-VMHostService -VMHost $vmhost | Where {$_.Key -eq "TSM-SSH"} | Start-VMHostService - Confirm:$false | Out-Null  Get-VMHostService -VMHost $vmhost | Where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService - Confirm:$false | Out-Null https://github.com/herseyc/PowerCLI-Scripts/blob/master/togglessh.ps1 togglessh.ps1

7 Solution Architect at SimpliVity VCDX-DCV #128 Website: http://www.vhersey.com/http://www.vhersey.com/ Twitter: @herseyc VMware vSphere 5.x Datacenter Design Cookbook http://www.amazon.com/VMware-vSphere-Datacenter-Design-Cookbook/dp/1782177000 http://www.amazon.com/VMware-vSphere-Datacenter-Design-Cookbook/dp/1782177000 About Me


Download ppt "Hersey Cartwright vBrownBag – Tech Talk VMworld 2015 Managing SSH with PowerCLI."

Similar presentations


Ads by Google