preloader
25 August 2011 / #Powercli #Vsphere

vCheck v5++

post-thumb

EDIT 29/09/2011 : Version 5.5.1 - Patching some minor bugs (thanks to MacBookeur for testing)

Today comes out our lovely hypervisor v5. Whith this new version comes great new features :p We will not speak of that, it is not the goal of this post, but rather to update the reporting-in-a-script aka vCheck.

For those who don’t know, vCheck is a script made by Alan Renouf (available here) and modified by our coworker hypervisor.fr. This helps to quickly make a report of what happened to your VMware platform and receive this lovely report by mail.

Since the last version, we changed this script by adding new features, optimizing the execution time (very useful for large infrastracture :p) and correcting small bugs.

Here is what you can find new in this version (non-exhaustive list, see the header of the script for complete information) :

  • ESX5 update (replacing obsolete property/method)
  • Adding Storage DRS Summary Info (Storage DRS Migrations count) and Maintenance Mode check
  • Tuning : Support of non HA Cluster for Capacity Planner
  • Checking for Thick Format disk on templates
  • Adding user exception for snapshot created/removed
  • Added TimeToBuild details for all modules (useful for large environnement informations)
  • Adding empty custom fields check
  • Optimization of objects call (based on Get-View collections at the begining of the script) > less execution time
  • Using CSS3 for coloring even lines : tr:nth-child(even), enhance view on huge table
  • Putting report on XHTML 1.0 Strict W3C compliant
  • Adding a debug mode (all tests, headers and TTB are shown)
  • Adding check made by enterpriseadmins.org

In order to test the script or wanted to use debug mode, we recommand you to source the script with the following command :

. ./vCheck-v551.ps1

It allows to keep variable content after the end of the script, very useful for debugging.

vcheck_cli

For scheduled tasks, here’s a export XML file in order to launch vCheck script on Windows 2008 (you’ll just need to change  path/user/password/frequency and import it) :

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.1" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Author>ammesiah</Author>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2009-08-28T17:00:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
    <CalendarTrigger>
      <StartBoundary>2010-02-08T08:00:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>VMDUDE\ammesiah</UserId>
      <LogonType>InteractiveTokenOrPassword</LogonType>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <IdleSettings>
      <StopOnIdleEnd>false</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT4H</ExecutionTimeLimit>
    <Priority>5</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe</Command>
      <Arguments>-command "c:\Scripts\vCheck\vCheck-v551.ps1 -VISRV vcenter-serveur -sendmail $true -htmlsave $true"</Arguments>
      <WorkingDirectory>C:\WINDOWS\system32\windowspowershell\v1.0\</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

We’d like to thanks a lot Alan and hypervisor.fr for this amazing tool, it’s really awesome, usefull daily, and even better than :

Macgyver Tool

And of course, we’ll update the script in the near future with new feature/check ^^


> Frederic MARTIN