How to Migrate VMs to New vCenter using PowerCLI

I faced this same question recently in my work environment. I was taking over the management of some infrastructure for a remote site, along with adding new hardware. The existing hardware was in a standalone vCenter, and the new hardware was connected to our enterprise vCenter. Lucky for me, the standalone vCenter was version 6.7 and has the ability to run the PowerCLI cross vCenter migrations.… Continue reading

PowerShell to Rename Datastores

At work we recently had a health check performed on our virtual environment. When the results came back, and I noticed a trend with our legacy VM hosts. Particularly where we didn’t follow the same standards as we did on the newer hosts. The issue I’ll be talking about, is renaming the local datastores. So now is the time to apply the same standards across the entire environment.… Continue reading

PowerCLI to list Template Info

We are starting to decommission the legacy VMware hosts in my work environment. Normally not a big deal or script for a task like this, but give me enough time I found a need. Templates. So you can easily find templates either using the H5 client or PowerCLI.

VM templates
Get-Template

This cmdlet displays a list of the template VMs that are in the environment, but it doesn’t say where they are located.… Continue reading

Using PowerCLI to Find Datastore with Missing VM

PowerCLI to Find Datastore with missing VM

During the last maintenance window at work, we starting having issues with vCenter, so to resolve the issues vCenter services were restarted.  After the vCenter services came back up, I noticed one of the servers on a host had lost it connection.  To make things worse, the datastore for the VM changed from the human readable format to location name.… Continue reading

Setting up VMware Tools Shared Product Locker with PowerShell

With the changes to how VMware Tools will be released, we finally decided to setup Product Locker. These changes were released in September 2015 VMware decided that the tools would be no longer depended on vSphere releases or ESXi builds.

Download VMware Tools here

One of our other VMware engineers found a script (link here) that could do this task, but it was seemed like it was wrote for a smaller environment than what we work with.  … Continue reading

Using PowerCLI to build multiple VMs

My first script that I ever wrote was a script to build VMs. I was the newest member on the team, and i was giving the task of building 50 VMs for a new project that was getting started. It was a very daunting task, due to the completion date to have these 50 VMs to be completed.… Continue reading

PowerCLI to find all VMs with thick provisioned VMDK

In my environment at work we have a policy that we thin provision all new VMs. We had an issue with a datastore that was running out of space, so I starting looking into it and found that several of the VMs on this datastore were set with thick provisioning on the hard drives.

This outputs a list of VMs with the storageformat that is set to thick. … Continue reading

PowerCli to get all VMs on certain Datastores?

From time to time, I get tasked with generating a report of production VMs with specs. This normally wouldn’t be an issue, but we have changed our server naming standard a few times, so we have machines with all sorts of names. The one thing in out environment that hasn’t changed is the datastore naming. We have our datastores split up between non-production and production, and each department has their own.… Continue reading

Get free space of all Datastores with PowerCLI

Before I spin up a new VM, I like to check which datastore has the most free space.  This can be completed with a PowerCLI command.

The problem with this, it it is too broad. This gets all of the datastores in vSphere, they are not in any sort of order, and it is also getting datastores that i wouldn’t normal use to put a VM on.  … Continue reading