Q: What VMware PowerCLI commands will create a datacenter and cluster, and then join hosts?

Greg Shields

June 8, 2011

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A: VMware PowerCLI is a command-line shell for executing Windows PowerShell scripts or commands against VMware ESX or ESXi servers. A separate installation, PowerCLI can be downloaded from VMware's site.

Four commands are necessary to connect to a vCenter server, create a datacenter and cluster, and then join hosts to the cluster. Those four commands, in order, are

Connect-VIServer –username -password

New-DataCenter –Location –Name

New-Cluster –Location -Name -DRSEnabled –DrsAutomationLevel FullyAutomated –HAEnabled –HAAdmissionControlEnabled

Add-VMHost -Location -Password


Note in the third command above that both DRS and HA are enabled for the created cluster, and that the DRS automation level is set to Fully Automated.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like