os:esxi:powercli
Table of Contents
ESXi - PowerCLI
Connect
more in this VMware PowerCLI Blog post
Components used in the following examples:
- Windows with installed vCenter Server: myWinvCenter01
- vCenter deployed as VCSA: myVCSA01
- User in vCenter to connect with: myvCenterUser
- Related user password: myvCenterPassword
Windows vCenter Server
Connect-VIServer myWinvCenter01 #... Disconnect-VIServer -Force -Confirm:$false
vCenter Server Appliance
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
Hardware-Info
Show physical disks on HP hosts
(Get-EsxCli -VMHost myVMHost).hpssacli.cmd("ctrl slot=0 pd all show")
Host Services
SSH (TSM-SSH) is used in the following examples on host myHost.
Start
Start-VMHostService -HostService (Get-VMHost myHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } )
Stop
Stop-VMHostService -HostService (Get-VMHost myHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" } ) -Confirm:$false
Status
Get-VMHost myHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH" }
Already connected to vCenter?
if($Global:DefaultVIServer) { "Connected." } else { "Not connected." }
os/esxi/powercli.txt · Last modified: 2018-11-10 22:34 by root