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

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 <serverName> –username <userName> -password <password>

New-DataCenter –Location <location> –Name <dataCenterName>

New-Cluster –Location <dataCenterName> -Name <clusterName> -DRSEnabled –DrsAutomationLevel FullyAutomated –HAEnabled –HAAdmissionControlEnabled

Add-VMHost <hostName> -Location <clusterName> -Password <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.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.