PowerCLI
Connect to vCenter or ESX host by using an encrypted password
- Store credentials in XML file. The password is encrypted
New-VICredentialStoreItem -Host server -Password PASSWORD -User beerensi -file C:\"PowerCLI\vicredentials.xml"
- Connect to vCenter by using the XML file
$creds = Get-VICredentialStoreItem -file C:\"PowerCLI\vicredentials.xml" Connect-VIServer -Server $creds.Host -user $creds.User -password $creds.Password
Running a schedule task
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe "& 'C:\PowerCLI\snapshot.ps1'"Change root password VMware ESX(i) host
Connect-VIserver servername Set-VMHostAccount -UserAccount root -Password Password
Change multipath policy to RoundRobin for HP LeftHand (naa.6000eb*) datastores
get-vmhost servername | Get-ScsiLun -CanonicalName 'naa.6000eb*' | Set-ScsiLun -MultipathPolicy "RoundRobin"
HP LeftHand = naa.6000*
HP EVA = naa.6001*
NetApp = naa.60a9*
Update VMware tools VM
get-vm VNNAME | update-tools
Get the total amount of vRAM used by the powered on VMs
Get-VM | where {$_.PowerState -eq "PoweredOn"} | Measure-Object -Property MemoryMB -Sum








