PowerCLI to deploy VMs in VMware vCloud and connect to network

vCloud PowerCLI

This PowerCLI script will help you to deploy VMs in VMware Private vCloud and connect to network.

 

PowerCLI script to Set Perennial reservation on RDM LUNs in a Cluster

Please find the Powercli script for configuring Perennial reservation on all RDM luns in a ESXi Cluster. Please change the value for following variables before you execute the script.

$vcenter = “vCenter.vmtest.com”
$dCenter = “123456”
$cluster = “Production Hypervisor”

This is the flow of script execution.

1. Get the list of RDM LUNs from the cluster.
2. Check the current perennial reservation status of the RDM. If it’s TRUE, no changes will be applied.
3. If the status is FALSE, the perennial reservation will be set on the LUN.
4. Script will query the latest status and the status will be displayed.

The result, after executing the script, looks something like this.

perinnial reservation

 

 

-SD

PowerCLI one liner for finding HBA model, WWPN and driver details.

Its a one liner for getting HBA details of all hosts connected to a vCenter Server.

PowerCLI one-liner to find the VM which has Raw access to a particular LUN

We had a requirement to find the VM with RDM which holds specific naa ID. The following one-liner made our task easy.

PowerCLI sccript for exporting VM details to HTML

Its a simple script for exporting VM details to HTML format. The HTML report created will be saved into the folder with the name of current month. It will help in generating a daily report with the help of Windows Task Scheduler. Refer this article for scheduling PowerCLI script.

Following details will be collected.

1. No of VMs in the vCenter.
2. No of Hosts connected in vCenter.
3. PowerState of VMs, IP address, Base ESX host, Cluster Name.
Continue reading