VM Report Generator - PowerCLI with a Winform GUI Written in 100% Powershell

Version 2

    There are certain VM properties that can cause problems in an ESX/ESXi environment.  This script creates a .Net  winform GUI that will allow the user to create a report based on five of these properties.  It allows the user to run the report immediately, save it as a script, or save it as a script and schedule it to run.  The report can be e-mailed and/or saved to a specific file on the system.




    The following are the five properties that can be monitored and why it is useful to look at them:



    VM Snapshots - While snapshots are one of the greatest things to come out of the virtualized world it can also be your bane if not monitored properly. Forgotten snapshots have frequently brought VMs and hosts to a hault as the delta files grow to fill disks. In addition forgotten snapshots with enough storage can grow so large that they start affecting performance on the VM. The VM Snapshot monitor will report when a VM has a snaphsot configured.



    Connected CD Drives/Connected Floppy Drives are properties that can cause problems in a DRS cluster. CDs and floppys that are connected can often force the VM to never get migrated as needed in a DRS cluster. In addition they can cause a host that is entering maintenance mode to require manual intervention. By monitoring these properties you can ensure that DRS and maintnenace mode will work when they are needed.



    DRS Override - This will notify you if someone has overriden DRS. This will prevent the cluster from VMotioning a VM to another host if resources are scarce.



    Powered Off - This will notify you when a VM is powered off. While you should have better monitoring in place for VMs that need to be powered on at all times this report can be very useful when trying to clean up your ESX environment. If a dev VM shows up on this report every week you can start asking the developers whether or not they need the VM.



    Video demonstration


    Author's Blog

    This script is not signed with a certificate.  You will need to copy and paste the contents into your own script or ensure that your execution policy is set to unrestricted.  This can be done from an administrator Powershell prompt with: Set-Exectuionpolicy unrestricted