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 […]

PowerShell: Create new Active Directory users

In my previous “PowerShell: Create new Active Directory groups, change group membership” blog post I published a PowerShell script that automates create Active Directory group creation. Today I needed to create multiple test user accounts and, and there were 12 account created already, the TestUser account number should start from 13. All New-ADUser cmdlet parameters […]

PowerShell: Create new Active Directory groups, change group membership

The following script helps you to:

Import Active Directory groups and their descriptions from a CSV file; Create Active Directory Groups and add Description If the Group is flagged (Yes or No), it will be added to another group (e.g. User groups –> Application provisioning group)

Excel view:

AD Group Name AD Group Description Add […]

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 […]

Cisco UCS: Add/Remove VLAN on vNIC using Powershell

Recently I worked in the environment where we needed to modify multiple UCS Service Profiles, adding and removing VLANs to/from vNICs.

If you are using vNIC templates – it is just a few clicks and you are done. But what if you don’t? What if you have 20 Service Profiles and each has 10 vNics […]

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 […]