PowerShell Friday: Enabling SSH with PowerCLI
Get-VMHost | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Start-VMHostService
Get-VMHost | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService
param($hostIP="<hostIP>")
<#
# Get-Module -ListAvailable VM* | Import-Module #import PowerCLI cmdlets
if ((Get-Module | Where {$_.Name -eq "VMware.VimAutomation.Core"}) -eq $null)
{ Write-Output "Importing VMware.VimAutomation.Core Module ..."
Import-Module VMware.VimAutomation.Core}
$cred = Get-Credential
Connect-VIServer $hostIP -Credential $cred
Get-VMHost | Get-VMHostService | where {$_.Key -eq "TSM-SSH"} | Start-VMHostService
Disconnect-VIServer -Server $hostIP -Force -Confirm:$false
#>
# Get-Module -ListAvailable VM* | Import-Module #import PowerCLI cmdlets
if ((Get-Module | Where {$_.Name -eq "VMware.VimAutomation.Core"}) -eq $null)
{ Write-Output "Importing VMware.VimAutomation.Core Module ..."
Import-Module VMware.VimAutomation.Core}
$cred = Get-Credential
Connect-VIServer $hostIP -Credential $cred
Get-VMHost | Get-VMHostService | where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService -Confirm:$false
Disconnect-VIServer -Server $hostIP -Force -Confirm:$false
Howto use ESXCLI in PowerCLIHow to use ESXCLI v2 Commands in PowerCLIPowerCLI 6.0 – Introducing PowerCLI Modules vs PSSnapin.