Add VMHost SSH management scripts
Add scripts for enabling and disabling the TSM-SSH service on ESXi hosts.
This commit is contained in:
31
Scripts/Start-VMHostSsh.ps1
Normal file
31
Scripts/Start-VMHostSsh.ps1
Normal 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')
|
||||||
|
}
|
||||||
31
Scripts/Stop-VMHostSsh.ps1
Normal file
31
Scripts/Stop-VMHostSsh.ps1
Normal 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')
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user