PowerShell PowerCLI Start Here
​
​
(Download PowerCLI) is a VMware toolset that adds a set of PowerShell Cmdlets to PowerShell via a module that provide scripting access to ESXI and vCenter. You can use this to configure ESXI, VM's or use it to create reporting of status and usage of ESXI and virtual machines and more...
It can be used as a stand alone command line interface but I usually load it into the PowerShell ISE for and troubleshooting scripts. You can get PowerCLI from logging into your VMware account.
#PowerCLI Version 6.0 Load
& 'C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1'
​
# Or PowerCLI Version 6.5 Load
& 'C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1'
​
​
Adds PowerCLI Snapin into PowerShell
​
Function PWR-CLI {
& 'C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1'
write-host ""
write-host "VMware Core Loaded"
write-host ""
}
​
​
Makes a Connection to vCenter/ESXi Host
Function CON-ServerA {
Connect-VIServer -Server IP_Address_Here -Protocol https -User Username_Here -Password Password_Here
write-host ""
write-host "Conencted to IP_Address_Here ServerA"
write-host ""
}
​
Disconnects Connection to vCenter/ESXi Host
​
Function DC-ServerA {
Disconnect-VIServer -Server IP_Address_Here -confirm:$false
write-host ""
write-host "Disconnected from IP_Address_Here ServerA"
write-host ""
}
​
​
​