more in this VMware PowerCLI Blog post
Components used in the following examples:
Connect-VIServer myWinvCenter01 #... Disconnect-VIServer -Force -Confirm:$false
Credentials have to be stored once per Windows User:
New-VICredentialStoreItem -Host myVCSA01 -User myvCenterUser -Password myvCenterPassword
Connect-VIServer -Server myVCSA01 -User myvCenterUser #... Disconnect-VIServer -Force -Confirm:$false
(Get-EsxCli -VMHost myVMHost).hpssacli.cmd("ctrl slot=0 pd all show")
SSH (TSM-SSH) is used in the following examples on host myHost.
Start-VMHostService -HostService (Get-VMHost myHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } )
Stop-VMHostService -HostService (Get-VMHost myHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } ) -Confirm:$false
Get-VMHost myHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" }
if($Global:DefaultVIServer) { "Connected." } else { "Not connected." }