This script will save you time and resources.

I have been using this script for the past month and it has highlighted a number of issues which would have been harder to find without it.

Daily Report does what it says on the tin, it runs as a scheduled task before you get into the office to present you with key information about your infrastructure in a nice easily readable format.

This script picks on the key areas of the virtual infrastructure and reports it all in one place so all you do in the morning is check your email.

One of they key things about this report is if there is no issue in a particular place you will not receive that section in the email, for example if there are no datastores with less than 5% free space (configurable) then the disk space section will not show in the email, this ensures that you have only the information you need in front of you when you get into the office.

So what areas does this script report on ?

Firstly it will give you a very brief summary detailing some of the critical information, it does not list every name and how many cpu’s or how much memory your vms and hosts have as that would be a audit report not a daily report.

image

There is a configurable section at the start of the script where you can set how many days old you would like your snapshots to be allowed in your infrastructure, anything over this will show in the report, it will even resolve the name ( the machine running the script must be part of an Active Directory Domain) so that you can forward this email on to them and ask them if they still need the snapshot.

image

There is a section which lists all datastores that have less than x% free space.

image

The below section notes any virtual machines which have been created in the last x days and who created these.

image

Similarly any VMs which have been deleted.

image

Any Virtual Center Events which have been logged during the given timeframe.

image

Any VM’s which have no VMtools installed.

image

The script will also hook into your virtual center server and tell you what the state of all VMware services are, if you use a different account to access you virtual center than the one which is running the script then you can set this at the start and the first time the script runs after this it will ask you for the credentials of the account and store these in an encrypted file for future use.

image

Also in the report but not screen captured is:

  • Any Windows events from the Virtual center server which are related to VMware
  • Any VMs which have CD-Rom or Floppy Drive’s connected
  • Any hosts in Maintenance Mode
  • Any Hosts ina disconnected state

At the bottom of he script is also an area which you can uncomment to save a the daily report as a htm file in a specific folder.

I think that’s it !

If there is anything missing please let me know and I will add it to future versions.

To run this script simple setup a scheduled task as per my previous post running the script and passing it your VI server as a parameter as below:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ ” &  “C:\Scripts\DailyReport.ps1 TESTVC01″

Check out the latest version here