Vote for the Top vBlog 2016

This is the first year that I’ve been included in the running for Top vBlog.  It feels good to be on the list with all of the other great virtualization blogs from around then web. This voting is taking place at, which is ran by Eric Siebert.  The polls are currently open and looking for the Top 25 vBlogs of 2016.… Continue reading

VMware PowerCLI Hands-on-Learning Review

Have you been wanting to learn PowerCLI but don’t have a test environment to practice with out the fear of breaking live production? That is where this hands-on-learning (HOL) lab from VMware can come in handy.  I personally worked through this HOL and found that the information that was provide to be very thorough to help with beginners wanting to start with PowerCLI.  … Continue reading

Using PowerCLI to set IP and Update VMware Tools

This is a continuation of my last post, Using PowerCli to Build multiple VMs.

After automating the building of VMs, what’s the sense of having to manually add the IP information or updating the VMware tools? It’s pointless. So we need to add the IP information to the CSV file that was used to build the VMs.… 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.

Get-Datastore | Get-VM | Get-HardDisk | Where {$_.storageformat -eq "Thick" } | Select Parent, Name, CapacityGB, storageformat | FT -AutoSize

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

How to setup a PowerShell profile and load the PowerCLI Snapin.

My PowerShell profile has been the most used script that I have wrote, and its not really a script.  The PowerShell profile runs every time that PowerShell ISE is opened. With this profile you can customize it to your needs.  It can load frequently used snap ins, functions or even custom properties.  When I help others with scripts, I forget that not everybody has a PowerShell profile setup and customized like myself.… Continue reading

How to stop non-responsive VM with PowerCLI

What do you do after trying to stop a VM that isn’t working. Either you and hope and pray that it will start reponding to vSphere commands, or you can Kill-VM.

Function Kill-VM {
      <# .SYNOPSIS Kills a Virtual Machine. .DESCRIPTION Kills a virtual machine at the lowest level, use when Stop-VM fails. .PARAMETER VM The Virtual Machine to Kill.
Continue reading

Add port group to all VMHosts with PowerCli

This is the script that I use when I need to add several new port groups to a single VMware cluster.  The script does check for the port group before it tries to add it to the VMhost encase it was already setup.

$NetworkInfo = Import-CSV C:\scripts\logs\NetworkInfo.csv
$ClusterName = "VM_Cluster"
$VMHosts = Get-Cluster $ClusterName | Get-VMHost
Foreach ($network in $NetworkInfo){
    $NewPortSwitch = $network.NewPortSwitch
    $VLANID = $Network.VLANID
    Foreach ($VMHost in $VMHosts){
        IF (($VMHost | Get-VirtualPortGroup -name $NewPortSwitch -ErrorAction SilentlyContinue) -eq $null){
            Write-host "Creating $NewPortSwitch on VMhost $VMHost" -ForegroundColor Yellow
            $NEWPortGroup = $VMhost | Get-VirtualSwitch | Select -last 1 | New-VirtualPortGroup -Name $NewPortSwitch -VLanId $VLANID 

Below is the format for the NetworkInfo.csv.… Continue reading