vCheck (Daily Report)

Introduction

vCheck is a PowerShell HTML framework script, the script is designed to run as a scheduled task before you get into the office to present you with key information via an email directly to your inbox in a nice easily readable format.

This script picks on the key known issues and potential issues scripted as plugins for various technologies written as powershell scripts 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 in the virtual infrastructure version of this script, it 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.

This script is not to be confused with an Audit script, although the reporting framework can also be used for auditing scripts too.  I don’t want to remind you that you have 5 hosts and what there names are and how many CPU’s they have each and every day as you don’t want to read that kind of information unless you need it, this script will only tell you about problem areas with your infrastructure.

What’s new in 6.0

vCheck 6.0 has been updated to be more community driven and easier to expand, the checks have been removed and put into separate plugins which make it easier for people to contribute.

The HTML output has been reformatted to work with newer versions of Outlook.

A Setup Wizard has been added for easy setup and no more need to reference the vCenter address as a parameter of the script.

As the plugins have been moved out it makes this HTML report framework easy to adapt to other PowerShell enabled products like VMware vCD, Sharepoint, Exchange, vShield, VMware View, SQL, Active Directory and more. – please contact me if your interested to start your own using this template.

A header image has been added to the HTML report.

And much much more.

What’s Available ?

Currently there is a vCheck report for each of the following:

What is checked for in the vSphere version ?

The following items are included as part of the vCheck vSphere download, they are included as vCheck Plugins and can be removed or altered very easily by editing the specific plugin file which contains the data.  vCheck Plugins are found under the Plugins folder.

  • General Details
    • Number of Hosts
    • Number of VMs
    • Number of Templates
    • Number of Clusters
    • Number of Datastores
    • Number of Active VMs
    • Number of Inactive VMs
    • Number of DRS Migrations for the last days
  • Snapshots over x Days old
  • Datastores with less than x% free space
  • VMs created over the last x days
  • VMs removed over the last x days
  • VMs with No Tools
  • VMs with CD-Roms connected
  • VMs with Floppy Drives Connected
  • VMs with CPU ready over x%
  • VMs with over x amount of vCPUs
  • List of DRS Migrations
  • Hosts in Maintenance Mode
  • Hosts in disconnected state
  • NTP Server check for a given NTP Name
  • NTP Service check
  • vmkernel warning messages ov the last x days
  • VC Error Events over the last x days
  • VC Windows Event Log Errors for the last x days with VMware in the details
  • VC VMware Service details
  • VMs stored on datastores attached to only one host
  • VM active alerts
  • Cluster Active Alerts
  • If HA Cluster is set to use host datastore for swapfile, check the host has a swapfile location set
  • Host active Alerts
  • Dead SCSI Luns
  • VMs with over x amount of vCPUs
  • vSphere check: Slot Sizes
  • vSphere check: Outdated VM Hardware (Less than V7)
  • VMs in Inconsistent folders (the name of the folder is not the same as the name)
  • VMs with high CPU usage
  • Guest disk size check
  • Host over committing memory check
  • VM Swap and Ballooning
  • ESXi hosts without Lockdown enabled
  • ESXi hosts with unsupported mode enabled
  • General Capacity information based on CPU/MEM usage of the VMs
  • vSwitch free ports
  • Disk over commit check
  • Host configuration issues
  • VCB Garbage (left snapshots)
  • HA VM restarts and resets
  • Inaccessible VMs

Plugins

vCheck has been designed to add output from any script (.ps1 file) in the plugins folder, each one of these will be run in numerical or alphabetical order and the output included in the vCheck report.  If you are not interested in the information for one of the checks it is highly recommended you remove the file as this will make the report faster.

All plugins can be found at the Plugins page of this site and will be updated frequently with new versions and new plugins from different authors.

For a great way to manage these make sure you check out Jake’s post here, he will show you how to use PowerCLI to easily check for new plugins and plugins which you do not have installed, you can even install them in a single command.

Headers

The Header.jpg in the root of the vCheck folder will be used and displayed in the title bar of the report (unless your email client does not support embedded base64 encoded images), this can be replaced with any image file of your choice but it is advised you stick to the same length and width as the current image.

A selection of headers can be found on the Headers page of this site.

Prerequisites

The following will need to be installed for you to run this script and report on your VMware environment:

  • PowerShell V2
  • PowerCLU 5.01 or later version
  • vCenter 2.5 or later version

Configuring the script

The first time you run this script it will go through a configuration menu, this configuration will be saved and used for all future runs of the script.  If you want to go back through the configuration or you add new plugins to the script then please run the script with the –config parameter as follows:

.\vCheck.ps1 –config

Output File

Some people like to save a copy of the HTML for future reference or so they can go back and see when a problem started happening, to do this use the –OutputPath parameter and specify a location where the HTML will be saved, to do this run the script as follows:

.\vCheck.ps1 –OutputPath C:\vCheckOutput\DailyReports

Running the script

The following video will show how to run the script for the first time and any subsequent runs after this:

Adjusting connection information

In some cases you will need to adjust the connection information used by the connect-viserver cmdlet to connect to your vCenter, this can be adjusted through the config wizard or if extra credentials are needed please edit the GlobalVariables.ps1 file on line 40 as below:

Before

$VIConnection = Connect-VIServer $VIServer

After

$VIConnection = Connect-VIServer $VIServer –user “AlternateUsername” –Pass “Alternatepassword” –Protocol Https

Example report

An example report can be seen by clicking the below image or here, please note that not all checks are triggered here.

vCheckSample

Download current version

Download vCheck 6.15
Downloaded 30758 times

Previous version Download

Download previous version (vCheck 5.0)
Downloaded 34462 times

Change log

# v 6.10 – Fixed multiple spelling mistakes and small plugin issues
# v 6.9 – Fixed VMKernel logs but had to remove date/Time parser due to inconsistent VMKernel Log entries
# v 6.8 – Added Creator of snapshots back in due to popular demand
# v 6.7 – Added Multiple plugins from contributors – Thanks!
# V 6.6 – Tech Support Mode Plugin fixed to work with 5.0 hosts
# V 6.5 – HW Version plugin fixed due to string output
# V 6.4 – Added a 00 plugin and VeryLastPlugin for vCenter connection info to separate the report entirely from VMware if needed.
# V 6.3 – Changed the format of each Plugin so you can include a count for each header and altered plugin layout for each plugin.
# V 6.2 – Added Time to Run section based on TimeToBuild by Frederic Martin
# V 6.1 – Bug fixes, filter for ps1 files only in the plugins folder so other files can be kept in the plugins folder.
# V 6.0 – Moved plugins into seperate scripts to make it easier to expand vCheck and fixed issues + lots lots more !
# V 5.1 – Code Fixes and ability to change colour for title text to fix issue with Outlook 2007/10 not displaying correctly
# V 5.0 – Changed the order and a few titles etc, tidy up !
# V 4.9 – Added Inacessable VMs
# V 4.8 – Added HA VM restarts and resets
# V 4.7 – VMTools Issues
# V 4.6 – Added VCB Garbage
# V 4.5 – Added Host config issues
# V 4.4 – Added Disk Overcommit check
# V 4.3 – Added vSwitch free ports check
# V 4.2 – Added General Capacity Information based on CPU and MEM ussage per cluster
# V 4.1 – Added the ability to change the colours of the report.
# V 4.0 – HTML Tidy up, comments added for each item and the ability to enable/disable comments.

FAQ

Q.  How do I add multiple Email recipients ?

A.  Edit the Global Variables.ps1 file and replace the line starting $EmailTo to the following:

$EmailTo ="user01@example.com", "user02@example.com"

771 thoughts on “vCheck (Daily Report)

  1. Hi Alan,
    Just a quick one. The NTP Server check doesn’t seem to like more than one value in the $NTPServer variable. I had to put a ForEach loop in so that it checks against each value in the variable. Once I did that it seemed to work fine.
    Thought i’d let you know so that you might change it in a new version!

    Many thanks,

    Chris.

  2. Hi,

    Next step … select a cluster and it wil be perfect :) Datacenter search is long long long when you have a lot of vm/cluster. I would like to exclude/select only specific cluster in the datacenter…will search and post a com if i did it :)

    • Finaly i split the vcheck :
      - infra vcheck with all script about datacenter
      - vm vcheck with all script about vm

      next step check only selected clusters …

  3. No I have not gotten around this yet, i can run the report manually, but not as a scheduled task, nor can i create the xml file like you

    • i did it without problem…can you tell us how you create your scheduled task?
      Try with : in action put in script/command powershell.exe
      and in “argument” (the first option under command/script) -f vcheck.ps1 (with full path)
      Tchô

  4. As you know, vmware5.1 use the Single Sign On and the user identification has gone to the username@fulldomainname or fulldomainname\username format. (example. John.Smith@somecompany.com or somecompany.com\John.Smith. My Question is this;
    1.) the windows scheduled task does not seem to take that format, or is assuming/truncating it to somecompany\john.smith. This results in failure to login, thus hanging the process. is there a method or workaround to use vCheck in a 5.1 environment?

    • Did you ever fix this? I have always loved VCheck but trying to get it to work in 5.1 as a nightmare. No matter what contation of credentials I use it will not create the XML file. Any ideas?

    • I am going to 5.1 in the next few weeks so am interested if we know how to keep the script running… I quite like my morning email capsule from vCheck.

      • I’m using 5.1 with vcheck for a quite long time. Every morning I get my little report in my email. I’ve just been in touch with 2 littles bugs in some plugin. If you search for my previous comments, you will find the way to correct it.

  5. Does anyone know if there is a way to exclude a datacenter? We have two datacenters in vcenter and one of them belongs to another group. We would like to report seperately but I haven’t seen a way to make this happen.

    Any help would be appreciated.

    Thanks,
    Joe

      • I’m not clear on this. What I need to do is to exclude reporting on all of the vms, datastores, and information in one of the two datacenters in vCenter. For example, if I had a prod and a test datacenter and I only wanted to report on prod.

        When you say two separate accounts do you mean that I would create an account for prod that had no rights to see the test datacenter? If so, wouldn’t that just fail out the script?

        Thanks for the reply!
        -Joe

        • I do not think it would fail out the script. I’ve been meaning to try it out on ours here since we have a similar dual setup and would like to send out a customer-limited report. We already have two accounts, one global (read-only) and one whose access begins at the secondary datacenter (read-only). Just need to set up the account on the script vm we use. Will let you know if it works for me when I get a chance to try it out.

          One caveat to this, I have severely hacked my copy of vCheck to make it run on different profile sets. I do not recall modifying anything that would effect what we are trying but cannot guarantee it.

          Hope this helps!

          -ChrisJ

  6. Hi all, this is a great script/plugin etc, thanks for all the work Alan.
    Running latest version of vCheck, What I would like to know is following, is it possible to exclude via user exception VM’s that are created/cloned and removed? I am thinking something similar to how there is a user exception for snapshots removed and created. Reason for this is the report is being flooded both the “VMs Created/Clone” & “VMs Removed” section of the report due to the way the Commvault Simpana Virtual Server backup with SnapProtect works. Once a SnapProtect job is executed CV mounts up the snap from the array and actually indexes the snaps, this entails adding and removing Vm’s from the Snap Volume. This is done by service account which means same user executing this in vSphere. So if it’s possible to have a “user exception” style exclusion for this 2 plugins would be great.

  7. Hi all

    The script seems to run fine for me, it sends me to my email accout the file with the info, but when i execute the scheduled task it promt me withe the box for user and password, i put a line in 40, but it keep on ask me for the credential

    any help?

    Thanks

    • I reply to myself, the change is done in the 00 Connection Plugin for vCenter ps1 file, and it works fine, one last thing, how can i encrypt the file?, because of the user and pass appears in text, and for security reason I will like to encryp it

      Thanls

  8. When running the script I am getting the following error:

    writeErrorStream : True
    Exception : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.VimException: 5/1/2013 4:45:38 PM Get-View
    View with Id ‘VirtualMachine-vm-2183′ was not found on the server(s).
    TargetObject :
    CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
    FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
    ErrorDetails :
    InvocationInfo : System.Management.Automation.InvocationInfo
    PipelineIterationInfo : {0, 1}
    PSMessageDetails :

    This is happening after:
    ..finished calculating General Information by Alan Renouf, Frederic Martin v1.1

    Can anyone advise what is going on?

    Thanks in advance.
    JD

  9. Is the information about “Adjusting connection information” is still valid? or I have to look for the connection information in some other file?

    Regards,
    Surya

  10. Great script. Anyone think of a reason why all my data is doubled up and in some cases, like with datastores, tripled or quadrupled?

    Thanks

    • check the no.of connections to the VC using powercli command- $global:DefaultVIservers,if there 1 session already then you end up with double data, try using disconnect-viserver * -confirm:$false

  11. Can vCheck provide peak cpu and memory utilization by cluster? I need the current resource (cpu and mem) allocation and peak utilization information to determine if the cluster has sufficient capacity to meet new VM resource requirements.

  12. I take it back, it still doesn’t work. I haven’t figured it out yet.

    If you move creating the PSOBject into the 2nd for each, it won’t print the 2nd disk’s information.
    If the PSObject is defined in the 1st for each, it will print each drive multiple times for the same host.

    I’ll keep tinkering see if I can make it work.

  13. We had an issue with ’19 Guests with less than X MB free.ps1′ where if a VM had multiple disks under the alert level, it would list the VM twice with 2 disks.

    I fixed this by moving the creation of $Details into the nested foreach loop.

    Contact me if you need more details.

  14. I use v6.15 and think its great for keeping tabs on my environment.

    I had a scheduled power interruption on one of the power feeds to my host last night (it has two power inputs so nothing went down). I did this at 4:52 pm MST. In my vCheck report that autogenerated the next morning, it shows a line from Plug in #36 – Host Alarms v1.1 that this happened, but it shows the time as 10:52 pm. When I log into the vSphere client to see the alert, it shows the correct time of 4:52 pm.

    MST is -7 although with daylight savings weirdness maybe that accounts for why vCheck reports it off by 6 hours. ???

    Have I missed some time setting parameter that I should have made or …?

    Thanks
    -Randy-

    • vCheck -config asks your about the timeserver to use on the local machine. if you are using a public NTP server, default is pool.ntp.org, make sure you are able to reach the server on port 123 for UDP communication.

      Regards,
      Surya

Leave a Reply