VMware PowerCLI script to get VM's virtual and RDM disk information

I have been tasked to migrate several VMs with RDM disks between storage arrays / datastores. The data LUNs have been migrated/copied and all was left is the migration of the VM configuration files and RDM pointers. To make matter even worse, VMs in question were Oracle RAC clustered VMs therefore is was imperative to […]

PowerCLI: Average CPU, Memory, Network and Disk usage

This simple PowerShell/PowerCLI script calculates the average CPU, Memory, Network and Disk usage for powered on virtual machines over the last 30 days, 5 minutes interval.

Amend ‘AddDays(-N)‘ and ‘-IntervalMins 5‘ if needed.

Get-VM | Where {$_.PowerState -eq "PoweredOn"} | Select Name, Host, NumCpu, MemoryMB, ` @{N="CPU Usage (Average), Mhz" ; E={[Math]::Round((($_ | Get-Stat -Stat […]

Configure DHCP reservation with Powershell

Quick Powershell script to add DHCP reservation for a VM on multiple DHCP servers:

Please refer to DHCP Server Cmdlets in Windows PowerShell for more details.

$DHCPservers = ‘DHCP001’, ‘DHCP002’ $Scope = ‘’ $IPaddress = ‘’ $Server = ‘SQL001’ $Domain = ‘’ $VM = Get-VM $Server # $VM.NetworkAdapters.MacAddress returns MAC address in semicolon separated 00:50:56:00:00:00 […]

Unable to remove permissions in vCenter

One of my customers was getting a strange error when trying to remove permissions in vCenter:

The “Remove Permission” operation failed for the entity with following error message. The object or item referred to could not be found.

But the user was there! I asked him to add a new user and then remove […]

EMC RecoverPoint upgrade fails: Unable to distribute ISO file.

EMC RecoverPoint 3.5.1 to 4.0 P1 upgrade fails.

During RecoverPoint “Prepare for Upgrade” wizard the RP upgrade ISO file were uploaded to the RPA. The problem was that the file name did not contain the MD5 checksum in the file name, i.e. “rel4.0.SP2.P1_m.29_release_emc.iso“.

Note from EMC RecoverPointSE Upgrade Guide:

IMPORTANT For all options, the ISO […]

VMware PowerCLI script to list Thin provisioned virtual disks (VMDK)

One of my clients was concerned about the number of virtual machines that were built with Thin provisioned disks. Before they go with the project to inflate all Thin provisioned disks (or migrate to Thick Provisioned Lazy Zeroed) they needed to know how much additional storage they would need.

PowerCLI to the rescue!

Yes, you […]

Exporting Virtual Machine information with PowerCLI

Just a quick script to export virtual machine inventory:

$report = @() foreach ($DC in Get-Datacenter -Name MyDC){ # Specify Datacenter name if needed foreach ($Cluster in Get-Cluster -Location $DC ){ # Specify Cluster name if needed foreach ($VM in Get-VM -Location $Cluster ){ $row = "" | select DC, Cluster, ResourcePool, VMPath, VMhost, PowerState, […]

VMware PowerCLI script to query Virtual Machine events

I have been asked to write a script to find out who created a particular VM or get a list of VMs that were built in the last N days…

Again, we need to go through the vCenter database and search for a particular event type or name. Cmdlet that is going to help us […]

HOW TO: Identify VMFS Datastore on Perennially Reserved LUN

We all well familiar with the problem with Raw Device Mapped (RDM) LUNs that are used by VMs running Microsoft Clusters Service.

VMware KB: 1016106

ESXi 5.0 uses a technique to determine if Raw Device Mapped (RDM) LUNs are used for MSCS cluster devices, by introducing a configuration flag to mark each device as “perennially […]

Who created these VM snapshots???

I am sure you have been in a situation where there are a lot of old, unidentifiable virtual machine snapshots and no one takes responsibility for creating them. How would you deal with all these “pre install”, “upgrade” or any other meaningless snapshot names without description?

Well, it is easy to find out when snapshot […]