PowerCLI: Find Zombie Files on Datastores

Everyone who works in our industry is familiar with RVTools. It’s a great tool that achieves a lot in short time in terms of infrastructure checks. I would not want to do my job without it.

One customer wanted to have a e-mail report that showed the “zombie” files on their datastores. After a RVTool check they saw that they wasted a lot of space for not removed snapshot delta disks that were not removed by their backup solution. This is a problem we see in almost every environment.

Read More »

PowerCLI: Report Empty LUNs

Once again I’m writing about a customer use-case. In this case the customer wanted to know if all of his many LUNs were actually being used or if there were any they could delete and save some storage space.

The customer has a very big environment so it would have been tedious to do this task by hand. PowerCLI comes to the rescue in form of this very short script that will basically just put together some information and send it to you by email.

Read More »

PowerCLI: Automating VMware Tools and Hardware Upgrades

A couple of years ago I struggled with VMware Update Manager in a large environment. The Use case was to update about a 1000 VMs to the latest VMware Tools and VM Version (hardware). The VUM did not do the job and froze in the middle of the job. Unfortunately due to the Shutdowns and reboots required to to achieve this we only had a small windows to achieve this in. After one unsuccessful attempt to do this with the VUM we decided to script it.

The original script was published in 2009 somewhere (source in the script) and we took that script and added some features (like doing a snapshot before installation on a linux-vm) and recently I have updated the script to work with the latest VM version (13 from vSphere 6.5).

Read More »

PowerCLI: Automating VM Shutdown triggered by USV

So another customer had a requirement. They want their USV to trigger a script that moves all VMs from one datacenter to the other datacenter in case of a power failure.

I started to write the following script, but it has not been finalized because some of the customer’s engineers are on holidays. I will update this post as soon as the final script is ready.

One thing to note: It uses the same VI Credential Store as my previous script to automate VM skeleton creation.

Read More »

PowerCLI: Automating VM Skeleton Deployment

We recently had to write a script for a customer which would deploy a VM skeleton. The script would be called from an automated solution the customer was building and had the following requirements:

  • Use given service-account for interaction in vCenter Server
  • Do different configuration based on the vm name which is passed as a parameter
    • test servers need to be placed in the “test” resource pool
    • test servers get a thin provisioned disk
    • production server need to be placed in “production” resource pool
    • production server need to placed in “test” resource pool
  • return value needs to be the MAC address of the created VM
  • VM must not exceed two vCPUs
  • VM must no exceed 8 GB RAM
  • VM disk must not be greater than 100 GB

Read More »