-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathStart-SSH.ps1
63 lines (56 loc) · 1.39 KB
/
Start-SSH.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.118
Created on: 4/6/2016 9:04 PM
Created by: Brian Graf
Organization: VMware
Filename:
===========================================================================
.DESCRIPTION
A description of the file.
#>
<#
.SYNOPSIS
Allows you to quickly enable SSH for your ESXi hosts
.DESCRIPTION
Description goes here
.EXAMPLE
PS C:\> GetStart-SSH
.NOTES
Additional information about the function.
#>
function Start-EsxSSH
{
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]$VMHost
#$VMHost
)
begin
{
if ($VMHost.gettype().basetype -is 'system.object')
{
write-host "string"
$SelectedHost = Get-VMHost $VMhost
}
elseif ($VMHost.gettype().basetype -is 'VMware.VimAutomation.ViCore.Impl.V1.VIObjectImpl')
{
Write-Host "VIObject"
$SelectedHost = $VMhost
}
Else
{
Throw "VMHost parameter needs to be a string or a 'VMware.VimAutomation.ViCore.Impl.V1.VIObjectImpl' object (Get-VMHost)"
}
}
process
{
$StartSvc = Start-VMHostService -HostService ($SelectedHost| Get-VMHostService | Where { $_.Key -eq "TSM-SSH" })
$StartSvc | select VMHost, Key, Running
}
end
{
}
}