Virtually everything is poshable
PowerCLI: Daily Report
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.
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.
There is a section which lists all datastores that have less than x% free space.
The below section notes any virtual machines which have been created in the last x days and who created these.
Similarly any VMs which have been deleted.
Any Virtual Center Events which have been logged during the given timeframe.
Any VM’s which have no VMtools installed.
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.
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″
| Print article | This entry was posted by Virtu-Al on July 14, 2009 at 20:33, and is filed under PowerCLI, powershell, vmware. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |







(3)
(13)
(0)
about 5 months ago
hey al, all your scripts are awesome, lol i check every week your page to see whats going on !, i was giving a try this Daily report, but i have an error, when it finishes and tryes to send the email with the report
Exception calling “Send” with “1″ argument(s): “Failure sending mail.”
i’ve already edited the script with the correct mail, and smtp server parameters.
can you give me a hand here?
about 5 months ago
Thanks for the comments !
That definitely sounds like an issue with the smtp settings, are you sure you have them correct, does your smtp server require authentication, can you telnet to the box on port 25 from the machine running the script ?
about 3 months ago
Just curious – will this work on just ESX 3.5 and ESX 3i servers? We are currently not running sphere. It be great to get this for my small environment with 7 production VMs.
Best Regards,
Fred Jumayao
about 3 months ago
@Fred
Yes it works on ESX 3.5, we have been using it for about 9 months now without any problem.
Mark