ESX Time : Power CLI, gathering/changing DNS info

Posted in : Uncategorized on by : Jay Anderson Comments: 0

Power CLI really is a very powerful tool.  It allows an admin to connect to a remote SSH session on an ESXi host as if they were at the machine.

First step is to install PowerCLI on your machine.  You can download it here : https://my.vmware.com/web/vmware/details?downloadGroup=PCLI650R1&productId=614

Second step is to connect to your vCenter or ESXi host directly.  To do this – open power CLI and type the following command:
Connect-VIServer -Server x.x.x.x -User DOMAIN\USERNAME -Password YOURPASSWORD
(x.x.x.x should be your servers IP address)

Some useful commands:
List IP information/DNS – “get-cluster “ClusterName” | get-vmhost | get-vmhostnetwork | ft -autosize”
(The ft -autosize fits the output of the script to the window your using – this can be added to almost any command that dosnt fit on the screen)

Set DNS servers on all hosts in a cluster:
get-cluster “CLUSTER_NAME” | get-vmhost | get-vmhostnetwork | set-vmhostnetwork -dnsaddress “1.1.1.1”,”2.2.2.2″,”3.3.3.3″,”4.4.4.4″
(All 4 IP address’ are DNS servers.  You can remove the 3rd and 4th address’ if you only want to have two servers)

 

Leave a Reply

Your email address will not be published. Required fields are marked *