Merge pull request #40 from pjorg/vmhost-ssh-scripts

Add VMHost SSH management scripts
This commit is contained in:
Alan Renouf
2016-12-02 08:55:09 -08:00
committed by GitHub
2 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<#
.NOTES
===========================================================================
Script name: Start-VMHostSsh.ps1
Created on: 2016-07-01
Author: Peter D. Jorgensen (@pjorg, pjorg.com)
Dependencies: None known
===Tested Against Environment====
vSphere Version: 5.5, 6.0
PowerCLI Version: PowerCLI 6.5R1
PowerShell Version: 5.0
OS Version: Windows 10, Windows 7
===========================================================================
.DESCRIPTION
Starts the TSM-SSH service on VMHosts.
.Example
.\Start-VMHostSsh -VMHost (Get-VMHost -Name 'esxi-001.lab.local')
.Example
$OddHosts = Get-VMHost | ?{ $_.Name -match 'esxi-\d*[13579]+.\lab\.local' }
.\Start-VMHost -VMHost $OddHosts
#>
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline=$True,Mandatory=$True,Position=0)]
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl[]]$VMHost
)
Process {
$svcSys = Get-View $VMHost.ExtensionData.ConfigManager.ServiceSystem
$svcSys.StartService('TSM-SSH')
}

View File

@@ -0,0 +1,31 @@
<#
.NOTES
===========================================================================
Script name: Stop-VMHostSsh.ps1
Created on: 2016-07-01
Author: Peter D. Jorgensen (@pjorg, pjorg.com)
Dependencies: None known
===Tested Against Environment====
vSphere Version: 5.5, 6.0
PowerCLI Version: PowerCLI 6.5R1
PowerShell Version: 5.0
OS Version: Windows 10, Windows 7
===========================================================================
.DESCRIPTION
Stops the TSM-SSH service on VMHosts.
.Example
.\Stop-VMHostSsh -VMHost (Get-VMHost -Name 'esxi-001.lab.local')
.Example
$EvenHosts = Get-VMHost | ?{ $_.Name -match 'esxi-\d*[02468]+.\lab\.local' }
.\Stop-VMHost -VMHost $EvenHosts
#>
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline=$True,Mandatory=$True,Position=0)]
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl[]]$VMHost
)
Process {
$svcSys = Get-View $VMHost.ExtensionData.ConfigManager.ServiceSystem
$svcSys.StopService('TSM-SSH')
}