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

vCheck 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.

Github

All scripts are now available via Github and can be modified as part of the Github website where I will approve the changes after checking, this enables everyone to get involved and add new features fast!

It also enables people to log issues in an easy way and control when they are fixed. Please do log your issues on the site rather than a comment on my blog.

To download the script check out the below example screenshot and click the “Download Zip” for each of the versions of vCheck, download links follow in this page for each of the versions.

image_thumb[3]

Download vCheck

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

Download Link Github Project Example Output Page
vCheck for vSphere Click here Click here
vCheck for Exchange 2010 Click here Click here
vCheck for vCD Click here Coming soon
vCheck for SCVMM Click here Click here
vCD Audit script Click here Click here
vCloud Air Audit Click here Click here
Cisco UCS Click here Click here

Now follow the video below to set up the vCheck script.

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.

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 for vSphere version of vCheck

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

  • PowerShell V2
  • PowerCLI 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 00 Connection Plugin for vCenter.ps1 file in the 00 Initialize folder as below or use the New-VICredentialStoreItem to store connection credentials:

Before

$VIConnection = Connect-VIServer $VIServer

After

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

Learn more

Want to learn more about the vCheck Project? Recently I spoke about it at the PowerShell Summit, you can watch the video here:

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"

Issues or feature requests?

If you have issues when you run this script or just wish it could do something different or new, add your thoughts to the github issues section here: https://github.com/alanrenouf/vCheck-vSphere/issues?state=open

846 thoughts on “vCheck (Daily Report)”

  1. A couple little bugs that I have found while creating/editing plugins and cant seem to track down where to fix in the code:
    1. If your [count] is less than 2, it does not work correctly. I have a plugin with only 1 result and the [count] is blank.
    2. If your results table only contains 1 column, it strips the column name and replaces it with an asterisk (*)

    (I’ve found a few other bugs that I have corrected, for example: The plugin report does not seem to actually display in order. This may be due to having $ListEnabledPluginsFirst enabled, so I added “,Name” to the sort options)

    1. Upgrade your Powershell version. Sounds like you are still on v2. Use WMF 5.0 and the ($obj).count problem goes away.

      Your other issues might also. I don’t know that off the top of my head.

      1. I believe these were valid bugs actaully; I submitted them to the GitHub page and they have been corrected in the code, but thank you for the reply.

  2. Hello Alan, This is awesome script.. I was looking for a script which specifically give me details like.

    How many svmotions in last 30 days, source and destination datastore and user details who moved it.

  3. Had some issue with 98 vSwitch Security.ps1. It was giving me a: “snap-in ‘VMware.VimAutomation.VdsComponent’ is not installed on this computer.” error.

    Made some changes in the following part which fixed it for me:

    # Check Power CLI version. Build must be at least 1012425 (5.1 Release 2) to contain Get-VDPortGroup cmdlet
    $VersionOK = $false
    if (((Get-PowerCLIVersion) -match “VMware vSphere PowerCLI (.*) build ([0-9]+)”)) {
    if ([int]($Matches[2]) -ge 1012425) {
    $VersionOK = $true
    # Add required Snap-In (nope, its a module)
    if (!(Get-Module -name VMware.VimAutomation.Vds -ErrorAction SilentlyContinue)) {
    Import-Module VMware.VimAutomation.Vds
    }
    }
    }

    Using PowerCLI 6.0R3.

    I thought I just leave it here.

  4. Is there a way i can configure the vCheck report to show output in datacenter wise instead of Issue wise report ?

  5. Hello alan,

    I am getting this foreground color error.

    Write-Host : Cannot bind parameter ‘ForegroundColor’. Cannot convert the “#FFFF8C00” value of type “System.Windows.Media.Color” to type “System.ConsoleColor”.
    At D:\Scripts\vCheck\vCheck.ps1:659 char:42
    + Write-Host $lang.pluginBegin -foreground $host.PrivateData.WarningForegroundColo …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Write-Host], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WriteHostCommand

    Can you please let me know what can be changed.

    Thanks
    vKar

    1. Is there a way i can configure the vCheck report to show output in datacenter wise instead of Issue wise report ?

  6. The given path’s format is not supported.
    At ————–\vCheck-vSphere-master\vCheck.ps1:767 char:16
    + $embedReport | Out-File -encoding ASCII -filepath $Filename
    + $embedReport | Out-File -encoding ASCII -filepath $Filename
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (:) [Out-File], NotSupportedException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

    the HTM file was failing to be created. it was trying to write the ipaddress:port# into the file name. not sure if that was the problem.

    Change the variable in the row 758 – works for me!!

    $Filename = $Env:TEMP + “\” + $VIServer + “_vCheck_” + $Date.Day + “-” + $Date.Month + “-” + $Date.Year + “.htm”

  7. Hello Alan / All , Will it possible to get the OrgVDC details in 07 vApp Details plugins in vCD vCloud air Audit?

  8. Awesomescript.I need a small help. Will it possible to get the out in this format. Org Name/VDCs Name/# of VMs/CpuLimitGhz/MemoryLimitGB/StorageLimitGB/CpuCountSizeGB/MemoryAllocationMB in one line. i tried to merge 07 vApp Details + 10 ORG VDCs list but its not working…

  9. See this come up with when some of the plugins run. Anyone know how to fix it?

    Get-ChildItem : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

  10. facing issues with host alarm, some cleared the alarm from the vcenter level , so how i can get the real hardware alarm from the each host through powercli

  11. Hey Alan,
    I’m getting following error, would you able to help me fixing the errors?

    I’m using PCLI 5.1 R1, PS 2, vCenter 5.1 U1, ESXi hosts 4.1 U2 & 5.1 U1

    Get-View : Cannot validate argument on parameter ‘VIObject’. The argument is null or empty. Supply an argument that is not null or empty and then try
    the command again.
    At F:\Scripts\vCheck\Plugins0 Connection Plugin for vCenter.ps1:92 char:21
    + $alarmMgr = get-view <<<< $serviceInstance.Content.alarmManager
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    12:08:27 AM Collecting Detailed VMHost Objects
    12:09:47 AM Collecting Detailed Cluster Objects
    12:09:48 AM Collecting Detailed Datastore Objects
    You cannot call a method on a null-valued expression.
    At F:\Scripts\vCheck\Plugins0 Connection Plugin for vCenter.ps1:101 char:70
    + $VIVersion = ((Get-View ServiceInstance).Content.About.Version).Chars <<<< (0)
    + CategoryInfo : InvalidOperation: (Chars:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

  12. Hey Alan,
    I’m getting following error, would you able to help me fixing the errors?

    I’m using PCLI 5.1 R1, PS 2, vCenter 5.1 U1, ESXi hosts 4.1 U2 & 5.1 U1.

    Get-View : Cannot validate argument on parameter ‘VIObject’. The argument is null or empty. Supply an argument that is not null or empty and then try
    the command again.
    At F:\Scripts\vCheck\Plugins0 Connection Plugin for vCenter.ps1:92 char:21
    + $alarmMgr = get-view <<<< $serviceInstance.Content.alarmManager
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    12:08:27 AM Collecting Detailed VMHost Objects
    12:09:47 AM Collecting Detailed Cluster Objects
    12:09:48 AM Collecting Detailed Datastore Objects
    You cannot call a method on a null-valued expression.
    At F:\Scripts\vCheck\Plugins0 Connection Plugin for vCenter.ps1:101 char:70
    + $VIVersion = ((Get-View ServiceInstance).Content.About.Version).Chars <<<< (0)
    + CategoryInfo : InvalidOperation: (Chars:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

  13. Hi,

    I am using vcheck on vmware and the plugin for snapshot information don’t return value for creator. I cant figure out why it is empty. I have not modify the plugin just run it.

    Hope if you can help me out here.

    .:: Niklas

  14. The only error I am getting running the script against SC VMM is below. Will appreciate any help to fix this please.

    Missing expression after unary operator ‘-‘.
    At C:\vCheck\Plugins13 Hyper-V Integration Components Version.ps1:83 char:3
    + – <<<< Query "SELECT * FROM Msvm_ComputerSystem WHERE EnabledState=2 AND NOT Caption LIKE 'Hosting Computer System'"
    + CategoryInfo : ParserError: (-:String) [], ParseException
    + FullyQualifiedErrorId : MissingExpressionAfterOperator

  15. When running the initial vCheck.ps1, a large proportion runs correctly but have the below errors. Any ideas?

    Method invocation failed because [System.Object[]] doesn’t contain a method named ‘CreateCollectorForTasks’.
    At C:\_pir\vCheck\Plugins2 Snapshot Information.ps1:80 char:62
    + $collectionImpl = Get-View ($taskMgr.CreateCollectorForTasks <<<< ($filter))
    + CategoryInfo : InvalidOperation: (CreateCollectorForTasks:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

    You cannot call a method on a null-valued expression.
    At C:\_pir\vCheck\Plugins2 Snapshot Information.ps1:83 char:45
    + $collection = $collectionImpl.ReadNextTasks <<<< ($tasknumber)
    + CategoryInfo : InvalidOperation: (ReadNextTasks:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\_pir\vCheck\Plugins2 Snapshot Information.ps1:99 char:34
    + $collectionImpl.DestroyCollector <<<< ()
    + CategoryInfo : InvalidOperation: (DestroyCollector:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Method invocation failed because [System.Object[]] doesn't contain a method named 'CreateCollectorForTasks'.
    At C:\_pir\vCheck\Plugins2 Snapshot Information.ps1:80 char:62
    + $collectionImpl = Get-View ($taskMgr.CreateCollectorForTasks <<<< ($filter))
    + CategoryInfo : InvalidOperation: (CreateCollectorForTasks:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

    You cannot call a method on a null-valued expression.
    At C:\_pir\vCheck\Plugins2 Snapshot Information.ps1:83 char:45
    + $collection = $collectionImpl.ReadNextTasks <<<< ($tasknumber)
    + CategoryInfo : InvalidOperation: (ReadNextTasks:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\_pir\vCheck\Plugins2 Snapshot Information.ps1:99 char:34
    + $collectionImpl.DestroyCollector <<<< ()
    + CategoryInfo : InvalidOperation: (DestroyCollector:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    10:47:34 AM ..finished calculating Snapshot Information by Alan Renouf, Raphael Schitz v1.1
    10:47:34 AM ..finished calculating Datastore Information by Alan Renouf, Jonathan Medd v1.2
    10:47:34 AM ..finished calculating Map disk region event by Alan Renouf v1.1
    10:47:34 AM ..finished calculating Hosts in Maintenance Mode by Alan Renouf v1.1
    10:47:34 AM ..finished calculating Hosts Not responding or Disconnected by Alan Renouf v1.1
    10:49:08 AM ..finished calculating Hosts Overcommit state by Alan Renouf v1.1
    10:49:09 AM ..finished calculating Hosts Dead Lun Path by Alan Renouf, Frederic Martin v1.1
    10:50:49 AM ..finished calculating Created or cloned VMs by Alan Renouf v1.1
    10:50:59 AM ..finished calculating Removed VMs by Alan Renouf v1.1
    10:50:59 AM ..finished calculating VMs with CPU or Memory Reservations Configured by Dan Jellesma v1.0
    10:51:23 AM ..finished calculating ESXi Inode Exhaustion by Matthias Koehler v1.0

  16. I am having this error below running the vCheck scripts for SCVMM. This happens on “001 SC VMM Connection Plugin.ps1”

    WARNING: SC VMM PowerShell cmdlets not available, the script is terminating

  17. Hi, For some reason I got error:

    Cannot convert argument “0”, with value: “VimApi_50.ManagedObjectReference”, for “SearchDatastoreSubFolders_Task” to type “VimApi_51.ManagedObjectReference”:
    “Cannot convert the “VimApi_50.ManagedObjectReference” value of type “VimApi_50
    .ManagedObjectReference” to type “VimApi_51.ManagedObjectReference”.”
    At C:\scripts\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:44 char:71
    + $taskMoRef = $dsb.Client.VimService.SearchDatastoreSubFolders_Task <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    + CategoryInfo : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

    Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
    Parameter name: moRef"
    At C:\scripts\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:45 char:67
    + $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMw
    are.Vim.VIConvert]::ToVim($taskMoRef)))
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    vCenter 5.1. update 1C

    Any ideas? Thanks!

  18. @Joey If you edit the — Connection Plugins for VCenter in the plugins folder on line 30 change it to the following

    $VIConnection = Connect-VIServer $VIServer –user “User” –Pass “Password” –Protocol Https

    (The information between the Quotes needs to be changed. This will then allow you to connect using different credentials) and allow it to be run unattended. The only problem with this is your password is in Plain text as the XML generation seems not to be working. But this is a good workaround.

  19. Great script, but I have a problem. Trying to insert user and pass so it can be ran unattended but downloaded script isn’t close to matching above posted. Tried inserting in several places but no luck. Any ideas? Thanks.

  20. Hi Alan

    Is there any way to run vCD vCheck with read-only access to vCloud Director?

    The only accounts that I have been able to run it with are the system administrator users and I don’t see any way to make an account with global read-only access.

    Any help appreciated 🙂

  21. Do you know how I can get plugin “19 Guests with less than X MB free” to sort by % free instead of Number of Disks? I modified it to add the percentage free but it’s still sorting weird. Thanks!

  22. Curious. I have yet to run only because i was not completely sure if the script would modify something. I am under the impression this is a read-only script and will not make any changes. The line that worries me is “Define the maximum amount of vCPUs your VMs are allowed [2]:”

  23. I removed PowerCLI and reinstalled it again, that fixed the issue. It still takes a few hours to run but it finishes running.

  24. I don’t know what I could be doing wrong, but anytime that I try to run this, I’m getting a bunch of errors and it just exits. I’m running it on a 2012 server with PowerCLI 5.5 installed. Here’s the type of errors I’m getting:

    PS C:\support\scripts\vcheck> .\vcheck.ps1

    Security warning
    Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
    computer. Do you want to run C:\support\scripts\vcheck\vCheck.ps1?
    [D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”): R
    At C:\support\scripts\vcheck\vCheck.ps1:118 char:18
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:124 char:18
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:209 char:54
    + Cod …
    + ~
    The ‘<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:211 char:11
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:215 char:64
    + <span class="full …
    + ~
    The '<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:218 char:13
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:221 char:68
    + <span class=" …
    + ~
    The '<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:224 char:11
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:229 char:56
    + W …
    + ~
    The ‘<' operator is reserved for future use.
    At C:\support\scripts\vcheck\vCheck.ps1:231 char:13
    +
    + ~
    The ‘

  25. Hi all

    Just finished installing vCheck on a vSphere 5.5 vCenter. Fantastic tool – cheers Alan!

    Here’s a couple of snags i ran into in case it saves someone else some effort 🙂

    – Use the vSphere 5.5 PowerCLI (currently VMware-PowerCLI-5.5.0-1295336). The older 5.1 version will run but one or more checks will hang mysteriously.

    – I think there’s a problem with the PowerCLI call that vCheck uses to retrieve VM hardware version, it returns ‘0’ for hardware version ’10’ for me, which means VMs will be included in the report when they are in fact up to date.

    – We had problems with the header image not being included in the report, which appeared to be due to Style.ps1 being called before $HeaderImg had been populated – I just moved it below the function that builds the image variable.

  26. I see from the example you indicated that I can save the html output to a folder, but it’s not working for me. Do I have to indicate a file name along with the folder location to save the HTML in a file?

  27. Any thoughts on being able to pass-thru parameters when executing the script? For example I have multiple virtual centers and want to be able to pass-thru the server name. e.g. ( .\vCheck.ps1 –server vcenter1). This way I can still use all the same “base” configuration except point it to a different vCenter when it runs.

  28. When running vCheck it gets stuck in ..finished calculating General information by Alan Renouf, Frederic Martin v1.2. it stays there for hours, even left it overnight but nothing happens beyond this line.

    1. Erick – any reply on this question? I am seeing the same behaviour when running it. Just sits there at calculating General Information…
      Any idea how to fix this?

  29. Since upgrading to PowerCLI 5.1 R2 my snapshot oversize script is now returning 0GB size and 0% oversize for all of the snapshots. Did anyone else get this and know a quick fix?

  30. I had a need to show which disks were below a percentage, the plugin #19 showed disks below a fixed size, which we had many small disks in Redhat. I changed the script as follows:

    # Start of Settings
    # VM Disk space left, set the percentage amount you would like to report on
    $MBFree = 20
    # End of Settings

    $MyCollection = @()
    $AllVMs = $FullVM | Where {-not $_.Config.Template } | Where { $_.Runtime.PowerState -eq “poweredOn” -And ($_.Guest.toolsStatus -ne “toolsNotInstalled” -And $_.Guest.ToolsStatus -ne “toolsNotRunning”)}
    $SortedVMs = $AllVMs | Select *, @{N=”NumDisks”;E={@($_.Guest.Disk.Length)}} | Sort-Object -Descending NumDisks
    ForEach ($VMdsk in $SortedVMs){
    Foreach ($disk in $VMdsk.Guest.Disk){
    $Details = New-object PSObject
    $DiskCapacity = 0
    $DiskFreeSpace = 0
    $DiskCapacity = [math]::Round($disk.Capacity/ 1MB)
    $DiskFreeSpace = [math]::Round($disk.FreeSpace / 1MB)
    $DiskPercentage = ($DiskFreeSpace / $DiskCapacity * 100)
    if ($DiskPercentage -lt $MBFree) {
    $Details | Add-Member -Name Name -Value $VMdsk.name -Membertype NoteProperty
    $Details | Add-Member -Name “Diskpath” -MemberType NoteProperty -Value $Disk.DiskPath
    $Details | Add-Member -Name “DiskCapacity(MB)” -MemberType NoteProperty -Value $DiskCapacity
    $Details | Add-Member -Name “DiskFreeSpace(MB)” -MemberType NoteProperty -Value $DiskFreeSpace
    $Details | Add-Member -Name “Disk Free %” -MemberType NoteProperty -Value (“{0:n2}” -f $DiskPercentage)
    $MyCollection += $Details
    }
    }

    }
    $MyCollection

    $Title = “Guests with less than $MBFree %”
    $Header = “VMs with less than $MBFree % : $(@($MyCollection).count)”
    $Comments = “The following guests have less than $MBFree % Free, if a guest disk fills up it may cause issues with the guest Operating System”
    $Display = “Table”
    $Author = “Alan Renouf/Bill Pendleton”
    $PluginVersion = 1.1
    $PluginCategory = “vSphere”

    Let me know if you can use this.

    Bill

  31. I fixed this by replaceing the SizeMB on line 42 of the 02 Snapshot Information.ps1 with @{n=’Size MB’;e={“{0:N2}” –f $_.SizeMB}}. Now it does two deciomal places and adds a comma.

  32. Hi Guys, I’m new to vCheck. Ran the script first time and got loads of errors, but reports came up nicely. Can anyone tell me how to resolve these errors or shall I ignore these erros.

    Sorry for the long one.

    The server certificate is not valid.

    WARNING: THE DEFAULT BEHAVIOR UPON INVALID SERVER CERTIFICATE WILL CHANGE IN A
    FUTURE RELEASE. To ensure scripts are not affected by the change, use
    Set-PowerCLIConfiguration to set a value for the InvalidCertificateAction

    Get-View : 9/7/2013 6:16:38 PM Get-View View with Id ‘VirtualMachine
    -vm-280’ was not found on the server(s).
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins2 Snapshot Informati
    on.ps1:88 char:18
    + $vm = Get-View <<<< $_.Entity
    + CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutoma
    tion.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Get-Datastore : Cannot validate argument on parameter 'Datacenter'. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\52 Datastore Consiste
    ncy.ps1:9 char:55
    + $Datastores = $VMHosts | Get-Datastore <<<<
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Get-Datastore : Cannot validate argument on parameter 'Datacenter'. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\52 Datastore Consiste
    ncy.ps1:10 char:110
    + $problemDatastoresObject = $VMHosts | ForEach {Compare-Object
    $Datastores ($_ | Get-Datastore <<<< )} | ForEach {$_.InputObject} | Sort Name
    | Select @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Compare-Object : Cannot bind argument to parameter 'ReferenceObject' because it
    is null.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\52 Datastore Consiste
    ncy.ps1:10 char:78
    + $problemDatastoresObject = $VMHosts | ForEach {Compare-Object
    <<<< $Datastores ($_ | Get-Datastore)} | ForEach {$_.InputObject} | Sort Name
    | Select @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Compare-Object], ParameterBind
    ingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.CompareObjectCommand

    Get-Datastore : Cannot validate argument on parameter 'Datacenter'. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\52 Datastore Consiste
    ncy.ps1:9 char:55
    + $Datastores = $VMHosts | Get-Datastore <<<<
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Get-Datastore : Cannot validate argument on parameter 'Datacenter'. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\52 Datastore Consiste
    ncy.ps1:10 char:110
    + $problemDatastoresObject = $VMHosts | ForEach {Compare-Object
    $Datastores ($_ | Get-Datastore <<<< )} | ForEach {$_.InputObject} | Sort Name
    | Select @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Compare-Object : Cannot bind argument to parameter 'ReferenceObject' because it
    is null.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\52 Datastore Consiste
    ncy.ps1:10 char:78
    + $problemDatastoresObject = $VMHosts | ForEach {Compare-Object
    <<<< $Datastores ($_ | Get-Datastore)} | ForEach {$_.InputObject} | Sort Name
    | Select @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Compare-Object], ParameterBind
    ingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.CompareObjectCommand

    The term 'Get-VDSwitch' is not recognized as the name of a cmdlet, function, sc
    ript file, or operable program. Check the spelling of the name, or if a path wa
    s included, verify that the path is correct and try again.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\80 DvPG with less tha
    n x Ports Free.ps1:6 char:22
    + $vdspg = Get-VDSwitch <<<< | sort Name | Get-VDPortgroup
    + CategoryInfo : ObjectNotFound: (Get-VDSwitch:String) [], Comman
    dNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    The term 'Get-VDPortgroup' is not recognized as the name of a cmdlet, function,
    script file, or operable program. Check the spelling of the name, or if a path
    was included, verify that the path is correct and try again.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\80 DvPG with less tha
    n x Ports Free.ps1:11 char:22
    + $PG = Get-VDPortgroup <<<< $i
    + CategoryInfo : ObjectNotFound: (Get-VDPortgroup:String) [], Com
    mandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    The term 'Get-VDPortGroup' is not recognized as the name of a cmdlet, function,
    script file, or operable program. Check the spelling of the name, or if a path
    was included, verify that the path is correct and try again.
    At C:\vCheck-vSphere-master\vCheck-vSphere-master\Plugins\98 vSwitch Security.p
    s1:35 char:16
    + Get-VDPortGroup <<<< | % {
    + CategoryInfo : ObjectNotFound: (Get-VDPortGroup:String) [], Com
    mandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  33. Whilst running this just now I got lots of errors in the “79 Find VMs in uncontrolled snapshot mode.ps1:11 char 38” plugin, they all said “cannot find path \xx.xx.xx.xx@443\\\A\B\C”.

    The reason is that the names of our VMs in vSphere have spaces in them like “Win7 test” and this causes the plugin to look for “…\Win7\test” instead of “…\Win7 test”.

    1. Had the same on my environment. My quick fix was to change the way it replaces contents of the path string (File “79 Find VMs in uncontrolled …” / Line 8):

      From:
      $Path = ($vm.Summary.Config.VmPathName).Split(‘/’)[0] -replace “[\[\]]”, “” -replace ” “, “\”

      To:
      $Path = ($vm.Summary.Config.VmPathName).Split(‘/’)[0] -replace “\[“, “” -replace “\] “, “\”

  34. I downloaded and ran the plugins, but the snapshot plugin is throwing an exception. Any Ideas?

    Get-Snapshot : Cannot validate argument on parameter ‘VM’. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
    At C:\Scripts\vCheck-vSphere-master\Plugins2 Snapshot Information.ps1:112 char:34
    + $Snapshots = @($VM | Get-Snapshot <<<< | Where {$_.Created -lt (($Date).AddDays(-$SnapshotAge))} | Get-SnapshotSummary)
    + CategoryInfo : InvalidData: (:) [Get-Snapshot], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetSnapshot

  35. I’m having trouble with the snapshot removed or creation plugin, the user exception wont work, I’m entering the user as domain\username but it’s being ignored. Any ideas as to what I’m doing wrong?

  36. I ran an older vCheck as well as the latest version for a couple of days. I am still testing but one issue is the newer vCheck was not showing any of the vCenter events to the older checks were showing. I did a Band-Aid fix and have added the variable $VCEventAge =7 into the plugin “23 VI Events.ps1” to get my 7 days for errors. Are any other plugins coded this way whereby variables are referenced before they are set?

  37. Corrections for Syslog script – “51 Syslog Name.ps1”

    @($VMH | Where-Object {$_.ExtensionData.Summary.Config.Product.Name -eq ‘VMware ESXi’} | Select-Object Name,@{Name=’SyslogSetting’;Expression = {(Get-VMHostAdvancedConfiguration -VMHost $_ -Name Syslog.global.logHost).Values| Where {$_ -eq $SyslogServer}}})

  38. Just started playing with this, and it is great. Thank you! I’m working on some updates to plugins and a new set of plugins for NetApp storage. If anyone else is working on NetApp plugins, let me know.

  39. A plugin to know how many vms per cluster, how many vms are up and donw…after you can add what you need 🙂

    # Start of Settings
    #End of Settings

    $MyObj = @()
    ForEach ($cluster in get-cluster)
    {
    $Details = “” | Select Cluster, VMs, VmsUP, VMsDown
    $Details.Cluster = $cluster
    $Details.VMs = (get-cluster $cluster | get-vm).count
    $Details.VMsUP = (get-cluster $cluster | get-vm | where { $_.PowerState -eq “PoweredOn” }).count
    $Details.VMsDown = (get-cluster $cluster | get-vm | where { $_.PowerState -eq “PoweredOff” }).count

    $MyObj += $Details
    }
    $Rapport = @($MyObj)
    $Rapport

    $Title = “Inventaire des vms”
    $Header = “Inventaire des VMs par Cluster”
    $Comments = “Inventaire et status des VMs dans chaque cluster”
    $Display = “Table”
    $Author = “Eric Le Nézet”
    $PluginVersion = 1
    $PluginCategory = “vSphere”

  40. I am trying to run the initial config:
    .\vCheck.ps1 –config
    and receive the following error message:

    # Enable License Reporting? [$true]:
    Index operation failed; the array index evaluated to null.
    At D:\My.fil\Tools14-CMS\VM\PowerCLI-Scripts\-MyStuff\vCheck\vCheck.ps1:25 char:4
    + $Question = $file[$Line]
    + ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArrayIndex

    []:
    Method invocation failed because [System.Object[]] doesn’t contain a method named ‘op_Subtraction’.
    At D:\My.fil\Tools14-CMS\VM\PowerCLI-Scripts\-MyStuff\vCheck\vCheck.ps1:48 char:4
    + $Line ++
    + ~~~~~~~~
    + CategoryInfo : InvalidOperation: (op_Subtraction:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

    Cannot convert the “System.Object[]” value of type “System.Object[]” to type “System.Int32”.
    At D:\My.fil\Tools14-CMS\VM\PowerCLI-Scripts\-MyStuff\vCheck\vCheck.ps1:55 char:3
    + $out += $File[$Endline..($file.count -1)]
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : ConvertToFinalInvalidCastException

    # If you use a proxy to access the internet please specify the proxy address here, for example http://127.0.0.1:3128 else use $false

  41. I’m trying to configure multiple users to hide from the removed snapshot plugin.
    any idea how to go about it ?
    for example i want to hide s-veeam and localdomain\backupuser ?
    thank you very much.

    1. A quick fix for those who are not skilled at modifying powershell code so they can hide any user with veeam in their name change $snapshotUserException =” *Veeam*”.

      If you want an additional user to be excluded/hidden then create another variable such as $snapshotUserException2 =” *backupuser*”, then add this into your match rule (shown below):

      (get-view (get-view ServiceInstance -Property Content.EventManager).Content.EventManager).QueryEvents($EventFilterSpec) | ?{$_.FullFormattedMessage -match “Remove snapshot” -and $_.userName -notmatch $snapshotUserException -and $_.userName -notmatch $snapshotUserException2} | Select createdTime, @{N=”User”;E={$_.userName}}, @{N=”VM Name”;E={$_.vm.name}}

  42. Now vCheck is on Github please raise any issues on the Github site in the issues section, this makes it easier to track and assign as needed.

  43. Hi
    I used this line in a CMD file I created and it works

    C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” “& “C:\scripts\vCheck\vCheck.ps1″

    for some reason there are playing with
    ‘ compare to ”

    I am using powershell 2.0

    good luck all and thanks for this amazing script.
    Haim

  44. Hi,

    Great Script!!!
    I use 6.15 and I see every entry in every section twice in the output.

    e.g

    Hosts which are in a disconnected state will not be running any virtual machine worloads, check the below Hosts are in an expected state

    host1.domain.local notResponding
    host1.domain.local notResponding

    Regards
    Stefan

  45. The part “Adjusting connection information” should be corrected. “GlobalVariables.ps1” does not contain line 40 with $VIConnection. Instead “00 Connection Plugin for vCenter.ps1” at line 26 should be used.

  46. @Nick,
    Thanks Nick. I hadn’t, but had just spotted an old post from Alan mentioning the | separator and have made the changes. Much neater than the Foreach loop!

  47. First I would like to say thanks to everyone who uses this script, everyone who has left a comment and a big thanks to those of you who have added your own plugins here. I am concious that this information was not getting plugged back into the script as fast as i would like so i wanted to make some changes to make that easier.

    From now on you can add changes and fix issues by looking at this post: http://www.virtu-al.net/2013/06/19/now-everyone-can-contribute-to-vcheck/

    Thanks, and I hope this will take vCheck to the next level!

    1. Thanks Alan and everyone for this great tools. The only thing I would love to see is a log folder about how the script did when it ran.

  48. 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.

  49. 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 🙂

    1. 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 …

  50. 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

    1. 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ô

  51. 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?

    1. 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?

    2. 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.

      1. 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.

  52. 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

      1. 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

        1. 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

  53. 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.

  54. 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

    1. 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

  55. 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

  56. 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

  57. 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

    1. 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

  58. 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.

  59. 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.

  60. 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.

  61. 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-

    1. 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

  62. Hi All – Can anyone suggest why the Storage I/O control module is reporting that we don’t have SIOC enabled when we actually do ? – Other than that the report is working excellently.

  63. Thanks a lot for this script, pretty handy!
    Is it really an issue if our VMs are thick provisioned though? Just saying, lol.

  64. When I put in the $VIConnection = Connect-VIServer $VIServer –user “AlternateUsername” –Pass “Alternatepassword” –Protocol Https it craps out and start giving me errors and no detail in the report. Please help!!

  65. Hi Alan, I’m getting “Swapfile location NOT SET” even though an explicit datastore is configured for every host at the cluster level. Any ideas why the script doesn’t recognise this..?

  66. Hi there, about the datastore information plugin. I also would like to display some extra information about the datastores like “provisioned space” and “used space” Is there a way to parse this in the existing plugin?

    Thanks,
    Erik

  67. The following plugins took longer than 60 seconds to run, there may be a way to optimize these or remove them if not needed.. How to fix this ? Please help

  68. Wondering if anyone is having the same problem as myself. I cannot get the VmClonedEvent to return any results on the ‘created or cloned VMs’ script. The other events show results as expected, but any VM’s that have been created from cloning another do not show.

    # Start of Settings
    # Set the number of days to show VMs created for
    $VMsNewRemovedAge =30
    # End of Settings

    $VIEvent = Get-VIEvent -maxsamples 10000 -Start ($Date).AddDays(-$VMsNewRemovedAge)
    $OutputCreatedVMs = @($VIEvent | where {$_.Gettype().Name -eq “VmBeingCreatedEvent” -or $_.Gettype().Name -eq “VmClonedEvent” -or $_.Gettype().Name -eq “VmBeingDeployedEvent”} | Select

    createdTime, UserName, fullFormattedMessage)
    $OutputCreatedVMs

    $Title = “Created or cloned VMs”
    $Header = “VMs Created or Cloned (Last $VMsNewRemovedAge Day(s)): $(@($OutputCreatedVMs).count)”
    $Comments = “The following VMs have been created over the last $($VMsNewRemovedAge) Days”
    $Display = “Table”
    $Author = “Alan Renouf”
    $PluginVersion = 1.1
    $PluginCategory = “vSphere”

  69. Thanks a lot for such a great script! We are running 6.15 and one of the things I noticed are these 2 errors while looking at the logs:

    ****************************************************
    2:21:47 PM ..finished calculating Powered Off VMs by Adam Schwartzberg v1.1
    2:21:47 PM ..finished calculating Guest OS Pivot table by Frederic Martin v1.1
    2:21:48 PM ..finished calculating Unwanted virtual hardware found by Frederic Ma
    rtin v1.1
    2:22:57 PM ..finished calculating Snapshot removed by Raphael Schitz, Frederic M
    artin v1.2
    Cannot convert argument “0”, with value: “VimApi_50.ManagedObjectReference”, fo
    r “SearchDatastoreSubFolders_Task” to type “VimApi_51.ManagedObjectReference”:
    “Cannot convert the “VimApi_50.ManagedObjectReference” value of type “VimApi_50
    .ManagedObjectReference” to type “VimApi_51.ManagedObjectReference”.”
    At C:\scripts\vCheck\Plugins\64 Snapshots Oversize.ps1:44 char:71
    + $taskMoRef = $dsb.Client.VimService.SearchDatastoreSubFolders_Ta
    sk <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    + CategoryInfo : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

    Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
    Parameter name: moRef"
    At C:\scripts\vCheck\Plugins\64 Snapshots Oversize.ps1:45 char:67
    + $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMw
    are.Vim.VIConvert]::ToVim($taskMoRef)))
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    2:22:58 PM ..finished calculating Snapshots Oversize by Raphael Schitz v1.1
    *************************************************

    and this:

    *************************************************

    2:24:10 PM ..finished calculating Disk Max Total Latency by Raphael Schitz, Fred
    eric Martin v1.1
    2:24:10 PM ..finished calculating Datastores in Maintenance Mode by Frederic Mar
    tin v1.1
    2:24:10 PM ..finished calculating Cluster Node version by Raphael Schitz, Freder
    ic Martin v1.1
    Attempted to divide by zero.
    At C:\scripts\vCheck\Plugins\71 Capacity Planning.ps1:25 char:36
    + $VmCpuAverage = $CluCpuUsageAvg/ <<<< (Get-Cluster $cluv.name|Get
    -VM).count
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

    Attempted to divide by zero.
    At C:\scripts\vCheck\Plugins\71 Capacity Planning.ps1:36 char:36
    + $VmMemAverage = $CluMemUsageAvg/ <<<< (Get-Cluster $cluv.name|Get
    -VM).count
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

    2:24:18 PM ..finished calculating QuickStats Capacity Planning by Raphael Schitz
    , Frederic Martin v1.3
    2:24:22 PM ..finished calculating Plugins not up to date or not installed by Ala
    n Renouf, Jake Robinson, Frederic Martin v1.1
    2:24:22 PM ..finished calculating Disconnecting from vCenter by Alan Renouf v1.1

    2:24:22 PM ..Sending Email

    *************************************************

    Any ideas?

    Thanks

    1. You’re not alone, I’m getting the same error. First I’ve thought in a corruption of my ps1 files, so I’ve completely reinstalll vCheck 6 but the error is still here. I’m running vCenter version 5.1.0 build 799731 and my esxs are in version 5.1.0 build 914609

    2. Ok Finally after one hour of debuging in the train, I’ve found the problem with script 64. you need to change line 34 and the following ones like this :
      if (($global:DefaultVIServer).Version -cge “5.1”){$searchSpec = [VMware.Vim.VIConvert]::ToVim51($searchSpec)}
      elseif (($global:DefaultVIServer).Version -cge “5”){$searchSpec = [VMware.Vim.VIConvert]::ToVim50($searchSpec)}
      elseif (($global:DefaultVIServer).Version -cge “4.1”){$searchSpec = [VMware.Vim.VIConvert]::ToVim41($searchSpec)}
      elseif (($global:DefaultVIServer).Version -eq “4.0.0”){$searchSpec = [VMware.Vim.VIConvert]::ToVim4($searchSpec)}

      $searchSpec.details.fileOwnerSpecified = $true

      if (($global:DefaultVIServer).Version -cge “5.1”){$dsBrowserMoRef = [VMware.Vim.VIConvert]::ToVim51($dsb.MoRef)}
      elseif (($global:DefaultVIServer).Version -cge “5”){$dsBrowserMoRef = [VMware.Vim.VIConvert]::ToVim50($dsb.MoRef)}
      elseif (($global:DefaultVIServer).Version -cge “4.1”){$dsBrowserMoRef = [VMware.Vim.VIConvert]::ToVim41($dsb.MoRef)}
      elseif (($global:DefaultVIServer).Version -eq “4.0.0”){$dsBrowserMoRef = [VMware.Vim.VIConvert]::ToVim4($dsb.MoRef)}

      In fact it’s missing the test for release 5.1.
      alan can you update the script in the distribution ?

    3. Finaly with return train, I’ve debugged the 71 plugins !

      I think you have created a cluster in your environement (as me) but actually no esx host are attached to it.
      So you can easy modify 71 plugins by adding in line 11 this :

      if ($cluv.Summary.NumEffectiveHosts -gt 0) {

      and close the } just after $capacityinfo += $clucapacity nearly the end.

  70. Does anyone you know off anyway to get 1 vCheck to run against multiple VC’s in Linked mode rather than 1 for each VC? I have to set it up for 8 x VC’s which isn’t that big an effort but seems rather than having to receive 8 emails with 8 separate reports, it would be awesome to recieve a mega report so to speak.

  71. @Lukas This is what worked for me…

    Change $Filename to $ArchiveFilename in JUST the following to avoid the archive file from getting deleted at the end… you will find xxx.vcheck.xxx.htm stuff in your user->appdata->local->temp directory that failed to delete.

    if ($Outputpath) {
    $DateHTML = Get-Date -Format “yyyyMMddHH”
    $ArchiveFilePath = $Outputpath + “\Archives\” + $VIServer
    if (-not (Test-Path -PathType Container $ArchiveFilePath)) { New-Item $ArchiveFilePath -type directory | Out-Null }
    $ArchiveFilename = $ArchiveFilePath + “\” + $VIServer + “_vCheck_” + $DateHTML + “.htm”
    $MyReport | out-file -encoding ASCII -filepath $ArchiveFilename
    }

    Al, this behavior seems to happen when both outputpath is specified and attachment to e-mail.

  72. I have a very strange problem. I think this started when I upgraded to PowerShell 3. In the snapshots section of the vCheck report the SizeMB column reports sizes with 20 decimal places. while I’m all for accuracy this seems like a little much. Any ideas on how to drop the decimal places and just show the whole number?

  73. Nevermind I found where it goes. It goes in the 00 Connection Plugin for vCenter
    NOT in the GlobalVariables. Hope this helps some other newbee like me!. Other
    than that it is SLICK!

  74. I put the $VIConnection = Connect-VIServer $VIServer –user “Administrator” –Pass “Johnb0” –Protocol Https on line 40 in the GlobalVariables.ps1 and it is still asking for a username and password. How do I automate it so I can just run the script and walk away without putting in anything extra

  75. I love vCheck Thank you!! Could you add version reporting of vCenter itself? Down where you have host build verions, it would be nice to see vCenter version, VUM version, etc. Especially for those of us with multiple vCenter servers.

  76. vCheck was incorrectly reporting the # of Datastore Clusters in my environment.

    Looking at “01 General Information.ps1” we can see it calls out $(@($DatastoreClustersView).Count)

    Unfortunately the collection for this variable is missing from “00 Connection Plugin for vCenter.ps1” To resolve, add the following code to the Connection Plugin:
    Write-CustomOut “Collecting Detailed Datastore Cluster Objects”
    $DatastoreClustersView = Get-DatastoreCluster | Sort Name

  77. Hi there, when running the vCheck script, does it impact the environment? Will end users be impacted? That is, if running the script will it impact the HOST, Datastores and vCenter in general?

    Is it possible to list the GUest via the “VM and Templates” child containers?

    Is it also possible to show the Chain Linked-Clones, Lenght and revert points?

    I am running Lab Manager 4 (and yes it dead) but until the company decides to move on. I need to generate a report
    for all LabManager configuration showing Linked-Cloned, revert point and usage on the various datastores.

    Thank,

    Troy

  78. @ayanes21 – You’re mixing versions of PowerCLI and vSphere / vCenter that aren’t totally compatible with each other. PowerCLI 5.1 is meant to be used with vSphere / vCenter 5.1. You need to use PowerCLI version 5.0 to work with vCenter 5.0. I’m not sure what the impact of vSphere 4.1 combined with vCenter 5.0 might be. It’s possible that you may need version 4.1 of PowerCLI for compatibility with vSphere 4.1.

  79. Was wondering if there was something wrong with Plugin 60 – Powered Off VMs.ps1? Doesn’t seem to be generating the correct results.

  80. For those intereseted in running against multiple vcenter servers.
    Create a pre_vcheck.ps1 script with the code below, then comment out $Server in globalvariables.ps1.
    $ServerList = “server1″,”server2″,”server3”
    foreach ($server in $ServerList) {
    .\vcheck.ps1 -$server -outputpath “\Output\”
    }

  81. @ Kevin Leek –
    This may or may not help. It has helped me with powerCLI quite a bit with speeding things up. Here you go:

    1. Start Internet Explorer
    2. Go to the Tools menu
    3. Go to Internet Options
    4. Go to the Advanced tab and uncheck “Check for publisher’s certificate revocation” so there is no tick in the box.

    Have a good day

  82. first like everyone I want to thank you for this awesome script, however when I run it I get various errors as follows during run time, I am using ESX 4.1 update 2 with vcenter server 5.0 and PowerCLI 5.1. Also I am running this script from my Windows 7 workstation and it takes over 2 hours to complete I only have 8 hosts and about 120 VMs …

    2:32:38 PM Collecting Detailed Alarm Objects
    Get-View : Cannot validate argument on parameter ‘VIObject’. The argument is null or empty. Supply an argument that is not
    null or empty and then try the command again.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins0 Connection Plugin for vCenter.ps1:92 char:21
    + $alarmMgr = get-view <<<< $serviceInstance.Content.alarmManager
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.
    GetVIView

    I have checked the globalvariables.ps1 and it is pointing to my vcenter server by host name..

    I also get these errors also

    2:32:43 PM Collecting Detailed Datastore Objects
    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins0 Connection Plugin for vCenter – Copy.ps1:101 char:70
    + $VIVersion = ((Get-View ServiceInstance).Content.About.Version).Chars <<<< (0)
    + CategoryInfo : InvalidOperation: (Chars:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    3:01:57 PM ..finished calculating Host Configuration Issues by Alan Renouf v1.1
    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\36 Host Alarms.ps1:4 char:29
    + $alarms = $alarmMgr.GetAlarm <<<< ($null)
    + CategoryInfo : InvalidOperation: (GetAlarm:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    4:21:01 PM ..finished calculating Snapshot removed by Raphael Schitz, Frederic Martin v1.2
    Get-View : Cannot validate argument on parameter 'VIObject'. The argument is null or empty. Supply an argument that is not
    null or empty and then try the command again.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:33 char:28
    + $dsb = Get-View <<<< (($ds | Get-View).Browser)
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.
    GetVIView

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:44 char:71
    + $taskMoRef = $dsb.Client.VimService.SearchDatastoreSubFolders_Task <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    + CategoryInfo : InvalidOperation: (SearchDatastoreSubFolders_Task:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:45 char:67
    + $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMware.Vim.VIConvert]::ToVim($taskMoRef)))
    + CategoryInfo : InvalidOperation: (WaitForTask:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Get-View : Cannot validate argument on parameter 'VIObject'. The argument is null or empty. Supply an argument that is not
    null or empty and then try the command again.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:33 char:28
    + $dsb = Get-View <<<< (($ds | Get-View).Browser)
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.
    GetVIView

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:44 char:71
    + $taskMoRef = $dsb.Client.VimService.SearchDatastoreSubFolders_Task <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    + CategoryInfo : InvalidOperation: (SearchDatastoreSubFolders_Task:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:45 char:67
    + $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMware.Vim.VIConvert]::ToVim($taskMoRef)))
    + CategoryInfo : InvalidOperation: (WaitForTask:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Get-View : Cannot validate argument on parameter 'VIObject'. The argument is null or empty. Supply an argument that is not
    null or empty and then try the command again.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:33 char:28
    + $dsb = Get-View <<<< (($ds | Get-View).Browser)
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.
    GetVIView

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:44 char:71
    + $taskMoRef = $dsb.Client.VimService.SearchDatastoreSubFolders_Task <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    + CategoryInfo : InvalidOperation: (SearchDatastoreSubFolders_Task:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:45 char:67
    + $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMware.Vim.VIConvert]::ToVim($taskMoRef)))
    + CategoryInfo : InvalidOperation: (WaitForTask:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Get-View : Cannot validate argument on parameter 'VIObject'. The argument is null or empty. Supply an argument that is not
    null or empty and then try the command again.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:33 char:28
    + $dsb = Get-View <<<< (($ds | Get-View).Browser)
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.
    GetVIView

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:44 char:71
    + $taskMoRef = $dsb.Client.VimService.SearchDatastoreSubFolders_Task <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    + CategoryInfo : InvalidOperation: (SearchDatastoreSubFolders_Task:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\users\aapolinar\Documents\Admin Tools\vcheck\vmware\Plugins\64 Snapshots Oversize.ps1:45 char:67
    + $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMware.Vim.VIConvert]::ToVim($taskMoRef)))
    + CategoryInfo : InvalidOperation: (WaitForTask:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

  83. @Ethan Lowry,
    to do multiple email addresses put this in the global variables like so:
    $EmailTo =”example@example1.com”, “example@example2.com”

  84. Great script – running this script on multiple VC’s seems to be a commonly requested feature. Adding multiple IP’s (seperated by a comma) doesn’t seem to be supported in the global vars.

  85. Hello,
    I have been using vCheck for a while and it is a great tool. I’m now running version 6 and would like to know if it is possible to output the results of the report to a .csv file.

    Any help appreciated.

  86. Hi,
    I have the same issue as Hein (Sept 4). I have no before part in my globalvariables.ps1 so don’t know where to set my login details, any ideas?
    Thanks for a great script.
    Michael

  87. I have the same problem Craig Wallace reported on 9/19/2012.
    How do I filter out snapshots created by our backup software??
    How do I enable using ‘VMs and Network Settings’ plugin??
    Thank you, Tom

  88. The setting change to have get multiple email recipients of the report doesn’t seem to function for me. I have tried all kinds of combinations without success (including the one posted in at the end of the vCheck page). Has anyone been able to get this to work?

  89. Hi all,

    Speed question. I have had vCheck running on a separate server from our vCenter server. Our vCenter server also hosts SQL.2008 on the same physical box.

    It was running 20-25 minutes every night beautifully.

    Then we migrated SQL/vCenter onto newer, faster hardware. Now, vCheck takes 120+ minutes every night.

    The new server hardware is using the same network cable and switch port as the old box, all drivers/firmware have been updated, and traditional network speed checks (file copy, etc) all check out good.

    So I assume there is something in the SQL/vCenter installation and/or configuration that is different and slowing it down compared to before. All the basic settings seem to be the same.

    Any suggestions on why it would be 5-10x slower on a new, faster box?

  90. Hi, the -outputpath does not work for me. It only creates the folders D:\vCheck\Archives\VI-Servername, but there is no file. Also no error. The directory were created automatically, so it should not be an ntfs-right-issue.

  91. Thanks for the excellent reporting tool!!
    I run Two vCenters both have a common user, is there a way to add in a second vCenter so I can run a single report on both?

  92. I’ve noticed that in situations where vCheck runs for hours that using some of the data collected at the beginning of vCheck will be stale and cause erroneous results. These results will cause me to look at reported issues that are not valid. I suggest that a timestamp be stored with information on when particular data was collected so that the plug-ins can make intelligent decisions based on this timestamp whether to freshen the data or continue using it as is.

  93. Can someone please help me in solving the below error

    PS C:\Pearl script> .\vCheck.ps1
    File C:\Pearl script\vCheck.ps1 cannot be loaded. The file C:\Pearl script\vChe
    ck.ps1 is not digitally signed. The script will not execute on the system. Plea
    se see “get-help about_signing” for more details..
    At line:1 char:13
    + .\vCheck.ps1 <<<<
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

  94. If we go to change the globalvariables file to add the account name and pass for the vcenter server we don’t see the Before part:

    Before

    1 $VIConnection = Connect-VIServer $VIServer

    After

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

    And even if we enter the new rule powershell says the connect-viserver function is not recognised. Are we missing something?

  95. FYI: The variable $limitSnapshotOversizeShow is not defined. I just add it in “64 Snapshots Oversize.ps1” with a value 120.

  96. Awesome script Al. Hoping to say thanks in person at VMworld.

    We have a few Fault Tolerant VM’s, and they often come up in the report for:
    27 VM Tools Issues.ps1
    19 Guests with less than X MB free.ps1
    22 Checking VM Hardware Version.ps1

    Sometimes they will be listed twice (i’m guessing primary & secondary VM), or listed once with no data.

    Is there a forum for this, or just keep using the comments? VMTN perhaps.

  97. I’m also missing the creator on the snapshot information section. Mainly noticed the issue when attachment is true.

    Secondary question is someone aware of an Active Directory or SQL script similar or based on vCheck?

  98. I have duplicate entries in my report. I must of messed something up. Anyone know what would cause everything to be reported twice?

  99. I want to change turn some of these checks into functions so I can load them in my powershell profile. This would be very useful as they can act as extensions to powercli…for example get-generalinfo or get-vmhostdeadluns for APD cases and so on….so what would be the easiest way to achieving this.

  100. Is there a one liner or something I can incorporate into a small script that woudl show:
    “Machine name: blah blah” was shut off at such and such time by such and such person” then email that alert? I know there is a “who deleted my vm script that is similar:

  101. I am using version 5 at the moment and its great however having issues running version 6. How do I save a script that uses seperate credentials then my own? This was possible in version 5 but in version 6 the login method is different now.

  102. I have 2 questions / Issues.
    1 – What is the easiest way to exclude multiple account names from the snapshots Created?
    2 – For some reason I am still not getting creator on the snapshot information plugin, any thoughts ?

  103. Hi Al,

    In our environment we run backups every night, how can i can get the snapshot plugin to ignore all the snapshots created by Netbackup and report on snapshots created by all other users.

    Great Script, Cheers Steve

  104. script runs fine, but the event logs only return info on what couldn;t be scanned, whereas the old version Error Events gave login failures etc….

    can i get that info from vCheck 6?

  105. Then I am sadly out of ideas. It worked for me but I don’t do enough scripting to see where I may have made any mistakes. If you figure it out, please let me know

  106. @Dave

    Thanks for the pointer for that plugin. I made the changes to the plugin but it’s still pulling all the warning messages. This is a great start and I’m going to have to scratch my head over this a little bit.

    Pat

  107. BTW I figured out as the snapshot account was just matching any part of the string, just omitting the domain name corrected that issue, but I am still looking for reasons for the “Swapfile not set” issue if anyone can help at all…

  108. @Pat
    I am not the best powershell user in the world so I make no claims to this being the best or most efficient way to do this but I noticed the same issue and made the following changes to plugin 44 and it seems to work for me. As the messages are text only, I don’t know if there is a way of looking for the past 24 hours, but instead I list those messages with todays or yesterdays date.

    If anyone can do this better, please tell me how… This is a learning experience as far as I’m concerned…


    ...
    ...
    ...
    foreach ($VMHost in ($HostsViews)){
    #
    # Dave - Additional variables for dates
    #
    $yesterday = (Get-Date -displayhint date -format "yyyy-MM-dd")
    $today = (Get-Date -date ((Get-Date).AddDays(-1)) -displayhint date -format "yyyy-MM-dd")
    #
    # Dave - End additional variables for dates
    #
    $product = $VMHost.config.product.ProductLineId
    if ($product -eq "embeddedEsx" -and $VIVersion -lt 5){
    # Original $Warnings = (Get-Log -vmhost ($VMHost.name) -Key messages -ErrorAction SilentlyContinue).entries |where {$_ -match "warning" -and $_ -match "vmkernel"}
    $Warnings = (Get-Log -vmhost ($VMHost.name) -Key messages -ErrorAction SilentlyContinue).entries |where {$_ -match "warning" -and $_ -match "vmkernel" -and ($_ -match $yesterday -or $_ -match $today)}
    if ($Warnings -ne $null) {
    ...
    ...
    ...
    else
    {
    # Original $Warnings = (Get-Log –VMHost ($VMHost.Name) -Key vmkernel -ErrorAction SilentlyContinue).Entries | where {$_ -match "warning"}
    $Warnings = (Get-Log –VMHost ($VMHost.Name) -Key vmkernel -ErrorAction SilentlyContinue).Entries | where {$_ -match "warning" -and ($_ -match $yesterday -or $_ -match $today)}
    if ($Warnings -ne $null) {
    ...
    ...
    ...

  109. This script is awesome and saves me so much time!

    I have recently been modifying parts of the script to use this more as an initial evaluation tool rather than an ongoing maintenance check and have encountered an issue with the “Guest with less than X MB Free” plugin. I would like this plugin to report on all guest disks and provide an output that includes GB of allocated disk space, GB of free disk space, and percentage of free space.

    I have worked out the first two but am having an issue with the percentage output as well as this generates a line for every guest disk on a VM so for example, if a VM has 5 guest disks there are 5 lines with the exact same info generated. Here is the current content of the plugin:

    # Start of Settings
    # VM Disk space left, set the amount you would like to report on
    $MBFree =10000240
    # End of Settings

    $MyCollection = @()
    $AllVMs = $FullVM | Where {-not $_.Config.Template } | Where { $_.Runtime.PowerState -eq “poweredOn” -And ($_.Guest.toolsStatus -ne “toolsNotInstalled” -And $_.Guest.ToolsStatus -ne “toolsNotRunning”)}
    $SortedVMs = $AllVMs | Select *, @{N=”NumDisks”;E={@($_.Guest.Disk.Length)}} | Sort-Object -Descending NumDisks
    ForEach ($VMdsk in $SortedVMs){
    $Details = New-object PSObject
    $DiskNum = 0
    $Details | Add-Member -Name Name -Value $VMdsk.name -Membertype NoteProperty
    Foreach ($disk in $VMdsk.Guest.Disk){
    if (([math]::Round($disk.FreeSpace / 1GB)) -lt $MBFree){
    $Details | Add-Member -Name “Disk$($DiskNum)” -MemberType NoteProperty -Value $Disk.DiskPath
    $Details | Add-Member -Name “Disk$DiskNum Capacity(GB)” -MemberType NoteProperty -Value ([math]::Round($disk.Capacity/ 1GB))
    $Details | Add-Member -Name “Disk$DiskNum FreeSpace(GB)” -MemberType NoteProperty -Value ([math]::Round($disk.FreeSpace / 1GB))
    $DiskNum++
    $MyCollection += $Details
    }
    }

    }
    $MyCollection

    If someone could assist me in adding the percentage output and removing the duplicate entries when guests have multiple disks it would be very appreciated!

    Thanks again I hope everyone keeps up the great work with this framework!

    -Lance

  110. I have poed over your site and have found so much good info for a newb at this like I am but I just cannot find the solution to my issue. I have your script vcheck 5.0 and powershell 2.o and PowerCLI 5.0 on 2 different farms. One works great, only thing missing from the report is the vm cpu/memuseage max/average. One on the other farm I continue to get the “The Connect-VISERVER Cmdlet did not work, please check you VI Server. ” message emailed to me. I have tried everything I have found on this site but it continues. Even tried starting from scratch with same raw script used on both farms. Would appreciate any help given. Thanks for all the work on these scripts huge timesaver!!!

  111. Hi Alan, I need your help. The reports runs fine through schedule task but i am unable to get an email in my mailbox. i am able to telnet my smtp server.

    Any idea ?

  112. Hi Alan,

    What a great script, thank you very much for making it available! I have one question though if you have the time.

    I am running the script on a vCenter that has vCloud connected to it and in the reports for VMware tools I get a list of all the vSheild edge devices. is there a way to exclude any VM with a name beginning with “vse-“. I am a novice PowerCLI user and could not see how to do it in your script.

    All the best!

  113. Hi Alan,

    THANKS to you and everyone for all the great work. I love version 6! But I’m having an issue with the VMKernel Warnings plugin. It pulls ALL the warnings from my log files no matter how old they are.

    I’m running vSphere 5 with ESXi 5 hosts so it looks like the script just pull everything that matches “warning”. Is there an easy way to add a date range so it only gets the last X days?

    Thanks again!

  114. Guys

    What is the syntax used to exclude virtual machines from vcheck?

    I would like to exclude a handful of machines from the check, appears a few people have asked this question but i dont see an answer?

    Awesome script btw

    cheers

  115. A few mods that I’ve made because I have multiple datacenters with the same cluster names and datastores with the same name…

    56 Clusters with HA Disabled.ps1: I need to know which datacenter it is in, so this will show the parent of the cluster.

    $Result = @( $Clusters | Where-Object {-not $_.HAEnabled} | Select-Object -Property Name,@{Label=’Datacenter’;Expression={$_.ParentFolder.Parent.Name}},HAEnabled)

    03 Datastore Information.ps1: Added datacenter and datastore type to the output.

    $OutputDatastores = @($Datastores | Select Name, Datacenter, Type, @{N=”CapacityGB”;E={[math]::Round($_.CapacityGB,2)}}, @{N=”FreeSpaceGB”;E={[math]::Round($_.FreeSpaceGB,2)}}, PercentFree| Sort PercentFree)| Where { $_.PercentFree -lt $DatastoreSpace }

  116. @l8nighter: Use this syntax for assigning the $EmailTo instead.

    [string[]] $EmailTo = “yourName@yourDomain.com”, “hisName@hisDomain.com”

    Rick

  117. I love the script. We were using version V2 and are currently upgrading to Vcenter 5 so I decided to check for a new version. New scripts are sweet except I can’t seem to get some of them to display. It runs with no erros but Im missing a few plugins that don’t show up in the report for example the datastore information… Do items only show up in the report if they have at least 1 vm or item matching the cirtera ?

    Thanks again

  118. Ok. I have done some digging of my own and found that the reason none of the VM’s that I know have CDROM’s configured is that the are not

    connected! This still has the effect that they can not be vMotioned. vCenter complains because they are host based (vmtools mounts, etc)

    Searching the web I found a few other ways of checking if a CDROm is configured (not just attached). The command I found worked the best was:

    $Result = @($VM | where {$_.cddrives | %{$_.IsoPath -ne $null}} | Select Name, VMHost)

    It still has issues. I’m a complete novive with powercli/powershell so I have no idea how I can rewrite this to fix the problem with the cddrives property. (Its obselete and I should use Get-CDDrive instead but its not a direct replacement 🙁 )
    It also reports a system if it has more than one CDRom even if both are configured asd client devices.
    I would like it to include the details of the mounted cdrom path but the code I found gives strange results in the report.

    Using ft name,host,@{label=”ISOPath”; Expr = { ($_ | get-cddrive).ISOPath } } instead of Select Name, VMHost

    This works from powershell directly but in the plugin.

    Any suggestions?

  119. Hi,
    basically, this is the same question as already posted by bwuch (May 14, 2011 at 13:13), but I didn’t find an answer yet.

    We have two vCenters running in linked mode.
    When running the vCheck script towards the first vCenter only this vCenter is polled. Is it possible to configure several vCenters in the GlobalVariables part?
    DefaultServerMode is set to multiple.
    If possible, I want to have all information in one report.

    Thanks,
    Sebastian

  120. One more thought, It would also be nice for checking if there was an otion to list all the VM’s that will be checked at the beginnign of the scripts. Again enabled as a variable, possibly as part of Plugin 01.

  121. Hi,

    Im running vCheck 6.15 under powerCLI 5.0.1. on windows 2008 against vcenter 5 (not update 1).
    I am seeing some odd behaviour. When running the script will all plugins, plugin 28 returns no results.
    If I run the script with plugins 00, 01, 28, Plugins not up to date…, and VerylastPlugin…, I get results from the first cluster only.

    My first question is, Is it possible to get the script to include the title of the plugin and say “No Problems found” rather than not including it in the report. That way I can see that the test has actually be run. It would be nice if this was an option variable along with the email options etc.

    Secondly, Why does the CD Roms conected plugin only check the first cluster when running as the only plugin and does not seem to run in combination with all the other checks? How can I fix this?

  122. ..oops, the brackets around my vcenter name made the name disappear from my previous post…

    It should read:
    ./vCheck5.ps1 vcenter01
    ./vCheck5.ps1 vcenter02
    ..

  123. Wonderful script Alan, so many thanks..

    In version vCheck5 I am used to run the script against 4 vCenters with a command line like:
    ./vCheck5.ps1
    ./vCheck5.ps1
    ..

    Will this option be available again in vCheck 6.xx?

  124. I’ve just built a new Win-7 VM so that I could upgrade to the new version of vCheck. It’s GREAT! Thanks to everyone for all the work that has gone into it.

    There’s only one problem that I’m having. When I run the script, there are 3 plugins (“41 vCenter Services.ps1”, “42 Windows vCenter Error Event Logs.ps1”, and “43 Windows vCenter Warning Event Logs.ps1” which give me the following error: Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA). I’ve checked my services and everything appears to be running OK.

    Any ideas?
    THANKS again!
    Pat

  125. “I am getting ‘Swapfile location NOT SET’ on all our hosts. I have checked, double checked, and even unset/reset the datastore, but it doesn’t seem to report right. Is this something I am doing wrong?

    …also, are there special characters that cannot be used as part of user exemptions (snapshots created and removed plugins). Our SAN creates and removes snapshots based on a domain account which contains a ‘\’ and a ‘.’ and while the header shows the right username as exempt, there are still dozens of snapshots listed with the same account details.”

    Any comments on these couple of issues please, esp the snapshot one. I am taking 2-hourly snapshots via the SAN which is creating pages and pages of report to scan through to make sure our users are not creating their own manually.

    Also… a couple of suggestions for an already great tool (no idea how much it would take to implement as I am not much of a powershell user). Firstly, is it possible to add an exceptions list, in its simplest form containing objects to omit from any results. We have standards for our own servers which I can report for anything outside these standards, but also we have third party VMs out of our control which I cannot do anything about. Secondly, is it possible to have a warning and critical threshold, perhaps colour coded on the report, for items that warrent it (like datastore free space etc).

  126. Great pack guys, thank you for the vCheck. It’s on completely different level from my own scripts 🙂 There is a lot of thinks, that I don’t even think about. Thanks again.

  127. Hi, i saw a post asking how to add a report that showing orphaned vmdk intu the report. I was looking that also and found in the vmware.com communitythat LucD write a PCLI script to show the orphaned vmdk list.
    Here is the code I was modified and save it in plugins folder of vCheck as XX Orphaned VMDK.ps1.

    # Start of Settings
    # End of Settings

    $report = @()
    $arrUsedDisks = Get-View -ViewType VirtualMachine | % {$_.Layout} | % {$_.Disk} | % {$_.DiskFile}
    $arrDS = $Datastores | Sort-Object -property Name

    foreach ($strDatastore in $arrDS) {
    $ds = Get-Datastore -Name $strDatastore.Name | % {Get-View $_.Id}
    $fileQueryFlags = New-Object VMware.Vim.FileQueryFlags
    $fileQueryFlags.FileSize = $true
    $fileQueryFlags.FileType = $true
    $fileQueryFlags.Modification = $true
    $searchSpec = New-Object VMware.Vim.HostDatastoreBrowserSearchSpec
    $searchSpec.details = $fileQueryFlags
    $searchSpec.matchPattern = “*.vmdk”
    $searchSpec.sortFoldersFirst = $true
    $dsBrowser = Get-View $ds.browser
    $rootPath = “[” + $ds.Name + “]”
    $searchResult = $dsBrowser.SearchDatastoreSubFolders($rootPath, $searchSpec)

    foreach ($folder in $searchResult)
    {
    foreach ($fileResult in $folder.File)
    {
    if ($fileResult.Path)
    {
    if (-not ($arrUsedDisks -contains ($folder.FolderPath + $fileResult.Path)))
    {
    $row = “” | Select DS, Path, File, Size, ModDate
    $row.DS = $strDatastore.Name
    $row.Path = $folder.FolderPath
    $row.File = $fileResult.Path
    $row.Size = $fileResult.FileSize
    $row.ModDate = $fileResult.Modification
    $report += $row
    }
    }
    }
    }
    }
    $report

    $Title = “Orphaned VMDK(s) Information”
    $Header = “Orphaned VMDK(s) Information”
    $Comments = “Orphaned VMDK(s) details on the Development infrastructure”
    $Display = “Table”
    $Author = “LucD”
    $PluginVersion = 1.0
    $PluginCategory = “vSphere”

  128. We have three virtual centers in our environment and i am running the report on all three from three different folders at 5am in the morning. All three get stuck at VC Services, Windows vCenter Error Event Logs and Windows vCenter Warning Event Logs plugins… any ideas? It

  129. I need to be able to send the vCheck email to multiple email address so I followed the FAQ above and changed it to $EmailTo ="user01@example.com", "user02@example.com"

    But when I run it gives me the following error:
    Ampersand not allowed. The & operator is reserved for future use; use “&” to pass ampersand as a string.

  130. It looks like “16 Host Swapfile datastores.ps1” should be checking for the absence of a value instead of checking for a value. I’m getting a list of all of my ESX hosts and I verified that they have a swap datastore set yet this plug-in produces output of “Swapfile location NOT SET”.

  131. br_nar says:
    May 24, 2012 at 06:17
    @noob: did you install PowerCLI v5.0.1?

    no, version 4. I installed 5 but no luck ….

  132. While we’re on the topic of querying AD Computer Objects, was wondering if one of your scripts (Alan or Andrew) could isolate or distinguish any Hyper-V Servers that might exist in the environment as well.

    Not sure how to accomplish this but what I do know is that the results of the command Get-Windows Feature is supposed to list what features and roles are available, and what their install status is (indicated by an X) on Windows Platforms. Since Hyper-V is installed as a Role in Server Manager this may be key to isolating its presence.

    Any help would be appreciated. Thx

  133. For some reason my management at work is harping on virtualization. We virtualized almost all of our physical servers over to ESXi 4.1 on Cisco USC Blades about a year ago. Manager wants a count of Servers by OS that are physical and virtualized and then total % virtualized. i.e. something like this:

    OS Virtual Physical
    Server 2003 1 5
    Server 2008 5 1
    Server 2008 R2 22 2
    ————————————————————————————
    36 Total Servers in Domain blah. 28 /36 (x%) Virtualized

    I’m struggling with what is the most efficient/accurate way of getting this info.

    Option A. Get-ADComputers where OS is like *server*. Ping list. If Ping = True then wmi query for Manufacturer or model as VMWare will write “VMWare, Inc” or something similar in those fields. Count Mfg/Model. Output to column. Else Model value is not “VMWare, Inc” therefore physical machine. Get total count of both physical and virtual. Divide to get % virtualized.

    Cons: Stale computer objects in AD. Machines not pingable, Machines powered off.

    Option B. Query AD for ADComputers where OS is like *server*. Ping list. If Ping then query for services -like “*VM*”. If service is found then its a virtual machine, Else its physical.

    Cons: If you query for VM Tools Service and someone forgot to install VM Tools then output isn’t accurate. Stale computer objects in AD. Machines not pingable due to network config, Machines powered off.

    Option C. Get count of all Server OS from AD (this will include all servers; virtual and physical). Get count of VM Servers using VMWare CLI\vcheck. subtract VM Count from AD Count and whatever is leftover is physical.

    Cons: Stale AD Computer Objects in AD. Inactive VM’s on VSphere.

    Option D. If we had standardized hostnames, I could query that from AD (ie. vServer1, vServer2, pServer3). Unfortunately, previous admins created hostnames on a whim with no consistency what-so-ever. So this is out of the question until we standardize.

    Which route to take? I realize that the output probably will never be 100% accurate but if I can get it to 90%+ then I would be happy. Am I over-complicating this? Any advice is greatly appreciated.

  134. I love this Framework! Thanks for creating and posting. I wrote my own weekly plugins for Active Directory (stuff like count of computers by OS, Expired Accounts, Passwords set to never expire,Orphaned Home Dir’s and Profiles, Users/Computers created last 7 days, etc etc etc) using this framework.

    Alan, I’m more than willing to share what I put together for AD but I’m a novice Powershell scripter at best. My scripting methods probably aren’t the most efficient in terms of execution time and can probably be cleaned up if you are willing.

    Chad posted about a NetApp vcheck. Is this posted anywhere yet? Also interested in a SQL/WebDev daily script if anyone has started that.

    1. Andrew,

      I have been sent a couple of AD scripts recently, I need to add these to my site, would be great to add yours to them if it covers areas they dont.

      Hopefully I will add these over the next couple of days.

      Alan

  135. I rely on the daily reports I receive from vCheck and think it’s great.

    One thing I am trying to work around though relates to plugin 44 VMKernel Warnings. I see a whole bunch of items there for all dates. I would much rather see just the items just from the previous day (since I have it running each day).

    I saw in the release notes “# v 6.9 – Fixed VMKernel logs but had to remove date/Time parser due to inconsistent VMKernel Log entries” I started with v6.15 so not sure what behaviour this specifically refers to but sounds like there used to be a date/time filter on the results shown, and then it was removed.

    Is it possible to restrict the included items? Is there a way to acknowledge those types of alerts so only new ones are included?

    Thanks
    -Randy-

  136. Would it be possible to exempt entries from appearing on plugin “53 Hardware status warnings-errors”?
    the report keeps tripping on “Battery on Controller 0 Charging …” messages which are normal behavior.
    thanks.

  137. When I run the script I get about a dozen errors when it starts processing plugin 02, the snapshot plugin.

    The error is:
    Get-View : 5/24/2012 8:30:19 AM Get-View View with Id ‘VirtualMachin
    e-vm-1909’ was not found on the server(s).
    At C:\scripts\Plugins2 Snapshot Information.ps1:88 char:18
    + $vm = Get-View <<<< $_.Entity
    + CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutoma
    tion.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Where does the view come from? We do not have any VMs that use the naming convention in the error messages. As I mentioned, I get about a dozen of these over about a 30 minute time span and then the script runs to completion fairly quickly.

  138. thanks for a great script !

    i have 1 problem …. i get “System.OutOfMemoryException” errors.

    2:58:48 PM Adding Custom properties
    2:58:48 PM Collecting VM Objects
    3:00:13 PM Collecting VM Host Objects
    3:01:39 PM Collecting Cluster Objects
    3:01:41 PM Collecting Datastore Objects
    3:01:44 PM Collecting Detailed VM Objects
    3:07:17 PM Collecting Template Objects
    3:07:56 PM Collecting Detailed VI Objects
    3:07:57 PM Collecting Detailed Alarm Objects
    3:07:57 PM Collecting Detailed VMHost Objects
    Get-View : 5/21/2012 3:18:26 PM Get-View Exception of type ‘System.OutOfMemoryException’ was thrown.
    At C:\ESX scripts\vCheck – xxxxVC03\GlobalVariables.ps1:87 char:23
    + $HostsViews = Get-View <<<< -ViewType hostsystem
    + CategoryInfo : NotSpecified: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.
    GetVIView

    Can someone help me understand how to solve this please ?

  139. Hi Alan,

    I have been working on creating a Hyper V flavor of vCheck using your HTML template and plugin structure. I would love to make this available to the community and would appreciate it if you could get in touch.

    Kind Regards,
    Ross Worth

  140. Hi All,

    When i run the report, for plugin 71 (Capacity Planning) I get the following error:

    Get-Cluster : 18/05/2012 11:12:57 Get-Cluster Cluster with name ‘HA%2fDRS Cluster’ was not found, using the s
    pecified filter(s).
    At C:\scripts\vCheck\Plugins\71 Capacity Planning.ps1:19 char:28
    + $cluvmlist = (Get-Cluster <<<< $cluv.name|Get-VM)
    + CategoryInfo : ObjectNotFound: (:) [Get-Cluster], VimException
    + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetClu
    ster

    And the report does not show any statistics under Estimated Num VM Left (CPU) etc.

    —–
    I am also having an issue with plugin 44 VMKernel Warnings.ps1. I have set my remote signed to unrestricted however it keeps coming up with
    "Security Warning
    Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your
    computer. Do you want to run C:\scripts\vCheck\Plugins\44 VMKernel Warnings.ps1?
    [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):"

    Any help would be greatly appreciated.

    Thank you

    Any help would be greatly appreciated.

  141. Nevermind about the plugin option vs globalvariables option. As I think more, you would want to be able to set other different parameters (like email address, subject, etc…). I will try to rework my changes to allow that choice instead. Thanks for everything!

  142. Love the script!!!

    I am extremely new to powershell in general and had one advice question. I added an extra param to the script to set a different plugins path. I am hoping that I can have different setups for different scheduled emails. Like one general stats set for the bosses, an error one for us folks in the trenches, etc… Do you think it would be more beneficial to do it that way or to have the plugins path in the GlobalVariables and make the GlobalVariables filename/path be an optional param?

    Thanks for your help to me and the community in general!!!

  143. I’ve been running a previous version for sometime. I run the script against several different vCenters. With the new setup of the script is there still a way to keep certain settings static and then feed parameters to the script for the different vCenters names? Or would I need to make a directory for each vc so that each has its own script and global variables file? Or is there a way to have a global variable file for each vc and feed that to the initial launch of the vcheck script?

  144. I’m trying out v6.15 against a v5 Update 1 vcenter and v5 Update ESXi hosts. Right now I have hte account I use for vCheck set with Admin privilidges but I’ll eventually dop that down to the lowest level needed. Teh account has non-porpogated rights at the top level, the propogated on a particular cluster and on the associated datastores. I’m see a few errors and I’m not sure if they are benign or will affect the related plugin.

    Errors, full run all included plug-ins enabled:

    You cannot call a method on a null-valued expression.
    At C:\vCheck\Plugins\25 VMs in inconsistent folders.ps1:7 char:69
    + $Folder = ((($CHKVM.Summary.Config.VmPathName).Split(‘]’)[1]).Split <<<<
    ('/'))[0].TrimStart(' ')
    + CategoryInfo : InvalidOperation: (Split:String) [], RuntimeExce
    ption
    + FullyQualifiedErrorId : InvokeMethodOnNull

    11:24:38 AM ..finished calculating VMs in inconsistent folders by Alan Renouf v1.1

    Get-VMResourceConfiguration : 4/30/2012 11:45:26 AM Get-VMResourceConfiguration
    Object reference not set to an instance of an object.
    At C:\vCheck\Plugins\50 VMs with CPU or Memory Limits Configured.ps1:10 char:36
    + @($VM | Get-VMResourceConfiguration <<<< | Where-Object {$_.CpuLimitMHZ -ne
    '-1' -or $_.MemLimitMB -ne -1} | Select-Object VM,CpuLimitMhz,MemLimitMB)
    + CategoryInfo : NotSpecified: (:) [Get-VMResourceConfiguration],
    VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
    n.ViCore.Cmdlets.Commands.GetVMResourceConfiguration

    11:45:36 AM ..finished calculating VMs with CPU or Memory Limits Configured by Jonathan Medd v1.1

    Get-View : 4/30/2012 11:47:10 AM Get-View
    At C:\vCheck\Plugins\61 Guest OS Version.ps1:12 char:16
    + $VM | Get-View <<<< | % {
    + CategoryInfo : NotSpecified: (:) [Get-View], NoPermission
    + FullyQualifiedErrorId : Client20_MoServiceImpl_GetNetInteropView_ViError
    ,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    11:47:28 AM ..finished calculating VMs by Operating System by Your Name v1.1

    You cannot call a method on a null-valued expression.
    At C:\vCheck\Plugins\62 Unwanted virtual hardware.ps1:9 char:53
    + $vmguest.Config.Hardware.Device | where {$_.GetType <<<< ().Name -match $
    unwantedHardware} | %{
    + CategoryInfo : InvalidOperation: (GetType:String) [], RuntimeEx
    ception
    + FullyQualifiedErrorId : InvokeMethodOnNull

    11:47:29 AM ..finished calculating Unwanted virtual hardware found by Frederic Martin v1.1

    Thanks!

  145. Alan,

    Cool script. I am running against a vCenter 4.1U2 system with ESX 4.1U2 hosts. My workststion is Win7. The vCenter server is Win2008. Whether I run the CLI from the vCenter server itself or from my workstation I am getting the following result:

    7:27:06 AM Connecting to VI Server
    7:27:18 AM Adding Custom properties
    7:27:18 AM Collecting VM Objects
    7:27:28 AM Collecting VM Host Objects
    7:27:30 AM Collecting Cluster Objects
    7:27:30 AM Collecting Datastore Objects
    7:27:30 AM Collecting Detailed VM Objects
    7:27:35 AM Collecting Template Objects
    7:27:36 AM Collecting Detailed VI Objects
    7:27:36 AM Collecting Detailed Alarm Objects
    7:27:36 AM Collecting Detailed VMHost Objects
    7:27:42 AM Collecting Detailed Cluster Objects
    7:27:42 AM Collecting Detailed Datastore Objects
    7:27:42 AM ..finished calculating Connection settings for vCenter by Alan Renouf v1.3
    7:27:42 AM ..finished calculating General Information by Alan Renouf, Frederic Martin v1.1
    Get-View : 4/25/2012 7:30:43 AM Get-View View with Id ‘VirtualMachine-vm-1909’ was not found on the server(s).
    At C:\scripts\Plugins2 Snapshot Information.ps1:88 char:18
    + $vm = Get-View <<<< $_.Entity
    + CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Get-View : 4/25/2012 7:30:43 AM Get-View View with Id 'VirtualMachine-vm-1909' was not found on the server(s).
    At C:\scripts\Plugins2 Snapshot Information.ps1:88 char:18
    + $vm = Get-View <<<< $_.Entity
    + CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Get-View : 4/25/2012 7:31:16 AM Get-View View with Id 'VirtualMachine-vm-5259' was not found on the server(s).
    At C:\scripts\Plugins2 Snapshot Information.ps1:88 char:18
    + $vm = Get-View <<<< $_.Entity
    + CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Get-View : 4/25/2012 7:31:20 AM Get-View View with Id 'VirtualMachine-vm-1905' was not found on the server(s).
    At C:\scripts\Plugins2 Snapshot Information.ps1:88 char:18
    + $vm = Get-View <<<< $_.Entity
    + CategoryInfo : ObjectNotFound: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetView_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Same error either way. I am not getting a login prompt for the server at all. I am logged onto my workstation with the same account that is the master admin of the vCenter and is in the Admin group on bothe systems. The VM names listed are not our naming config. Any pointers on where the error may be?

  146. I am getting ‘Swapfile location NOT SET’ on all our hosts. I have checked, double checked, and even unset/reset the datastore, but it doesn’t seem to report right. Is this something I am doing wrong?

    …also, are there special characters that cannot be used as part of user exemptions (snapshots created and removed plugins). Our SAN creates and removes snapshots based on a domain account which contains a ‘\’ and a ‘.’ and while the header shows the right username as exempt, there are still dozens of snapshots listed with the same account details.

    Love the tool though, and especially the new format with v6. It’s made my life a lot easier! Thank you!

    @Chad, I would be very interested to see what you have done with the NetApp plugin too…

  147. Hi Al,

    Great script, absolutely amazing, a couple of things i would like to ask about though are with snapshots. How can i stop it from detailing snapshots created and removed by VCB, and also how can i configure it to identify orphaned snapshots.

  148. Hi Alan;

    My PowerShell scripting sucks. I’m hoping to generate a Report that lists the Primary Nodes of all Clusters. I can run the PowerCLI manually but can’t seem to run it thru vCheck.

    This is the gist of what I’m trying to achieve:

    $_.HAEnabled -eq $true
    Get-HAPrimaryVMHost
    Select Name, Parent
    Sort by Cluster Name

    We’ve been having HA issues recently in our Blade environment. Troubleshooting this was a pain but results revealed the Primary HA Node (or “fail-over Coordinator” ) had gone offline. Unfortunately, the promotion of a Secondary Host failed to occur before the Host went offline… This had negative effects on HA functionality of the Cluster as a whole.

    Any help, by anyone, would be appreciated.

    Thx

  149. Hi Chad,

    I’m very interested in your script for the NetApp filers! I’ll keep track on Alan whenever he releases them.

  150. I altered the GlobalVariables.ps1 and vCheck.ps1 to allow for one to use Gmail as their outgoing mail server. We use Google Apps for email and I had to allow for SSL encryption and an alternate port for sending email. I added some variables to GlobalVariables.ps1 so that it could be configured during the setup and then changed the email function around a little in vCheck.ps1 to allow for the new settings. I could upload the code changes if anyone is interested.

    I also just finished a NetApp plugin which will report on the status of your Netapp filers, report on any volumes over X% utilization, and also report on any snapshots older than X days and larger than X MB. I can upload these as well, but not sure how to do so at the moment.

  151. Line 23 of 01 General Information reads
    $VIVersion -ge 5 shouldn’t this be $VIVersion -ge “5” I’m only running VI 4.1 and the system keep checking for the vSphere 5 info.

  152. Hi Alan,

    First of all, thank you for vCheck. It’s very usefull.
    We got a little issue when we sent the report in HTML mail : the header (the picture) is not display and the results of some plugins (typicaly the first and the last) appears in Time new roman and not in Tahoma. If we display the result in a web browser all is alright.
    Have you any idea to resolve our issue ?

    Thank in advance and keep going on !
    Seb.

  153. Thanks for the great work guys.
    Is there any way to get the script to interrogate more than one vCenter server?

    In GlobalVariables.ps1 i can see the variable $Server being called.
    How do i assign it more than one vCenter server?

  154. Hi I’m getting the following error when called within the script but do not get this error when I run the cmdlet on its own. Any clues?

    Get-View : 2012-04-03 13:02:50 PM Get-View Exception of type ‘System.
    OutOfMemoryException’ was thrown.
    At C:\vcheck6.15\Plugins0 Connection Plugin for vCenter.ps1:94 char:23
    + $HostsViews = Get-View <<<< -ViewType hostsystem
    + CategoryInfo : NotSpecified: (:) [Get-View], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
    n.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

  155. Guys

    When running this after the initial config i get the following error and i keep getting the credentials prompt, anyone got any ideas? I am trying to automate this but during the scheduled task it stops here waiting for me to enter username and password.

    ConvertTo-SecureString : Key not valid for use in specified state.
    At C:\Scripts\vCheck\vCheckVMWare\xxxxxxxxxxxx\Plugins\41 vCenter Services.ps1:6
    char:145
    + $creds = New-Object System.Management.Automation.PsCredential($LoadedCred
    entials.Username,($LoadedCredentials.Password | ConvertTo-SecureString <<<< ))
    + CategoryInfo : InvalidArgument: (:) [ConvertTo-SecureString], C
    ryptographicException
    + FullyQualifiedErrorId : ImportSecureString_InvalidArgument_Cryptographic
    Error,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand

    New-Object : Exception calling ".ctor" with "2" argument(s): "Cannot process ar
    gument because the value of argument "password" is null. Change the value of ar
    gument "password" to a non-null value."
    At C:\Scripts\vCheck\vCheckVMWare\xxxxxxxxxxxx\Plugins\41 vCenter Services.ps1:6
    char:21
    + $creds = New-Object <<<< System.Management.Automation.PsCredential($Load
    edCredentials.Username,($LoadedCredentials.Password | ConvertTo-SecureString))
    + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
    tionException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
    Shell.Commands.NewObjectCommand

    07:04:01 ..finished calculating VC Services by Alan Renouf v1.1

  156. How do I find out when the vCheck script will be run and when I will get the generated email? Does it generate an email every time it runs? If so, I never got an email on the initial run of the script.

  157. In plugin “00 Connection Plugin for vCenter.ps1″ the line
    $Report.Name = $_.Name”
    in the functions Get-VMLastPoweredOffDate and
    Get-VMLastPoweredOnDate should be changed into:
    $Report.Name = $vm.Name

    Otherwise the functions won’t work correctly if you don’t use the pipeline.

  158. Hi Allan ,
    Firstly , much appriciate your hard work to made our life easy with this script.Also wondering we can add a little plugin that will also list the VM’s got network adapter disconnected. Something like the following I got from google search…

    $ConnectedExp = @{ Name = “Connected”; Expr = { ($_ | Get-NetworkAdapter).ConnectionState.Connected } }
    get-vm | select name, $ConnectedExp | where-object { !$_.Connected }

    Ashraf

  159. Hello, firstly great script – thank you for all the effort!

    I am getting an oddity with the datastore overallocation script, it is reporting that several datastore are overallocated by varying percentages – however all the datastores in question only house “thick” disks and are not showing as overallocated in vCenter.

    is anyone else seeing something similar?

    ta
    martin.

  160. @alan, unsubscribe is still a pain in the ass… 🙂

    This is the management page for following blogs. You will receive an email at xxxxx@gmail.com whenever a new post is made on these sites. Unfollow a blog to stop receiving emails from that blog.

    You are not actively following any blogs. <—– uhm i'm not subsribed ???

    If you are expecting to see blogs that you are following here please check that you used the same email address and that they are not still pending.

  161. Was hoping, Alan, you or someone else could reply to my previous post.

    If I run this tool on a VM, results on the Datacenter in which the VM resides only are returned. If I run the tool (same credentials, etc) from a physical device that is not managed by the vCenter, I see results of all Datacenters.

    Is this standard behaviour? Do I need to configure or modify the script in any way to report on all (other) Datacenters when running from a VM managed by the vCenter that is being checked?

    Thx

  162. upgraded to PS 5.0.1 and still cannot get “Creator” field to populate for snapshot report.

    can anyone share the fix? thanks
    awesome script, al.

  163. Ignore the above one, after reading some of the replies I removed PowerCLI 5 and rebooted and reinstalled which sorted it out.

  164. Hi, love the new version of the script, two issues with 52 and 71 which using the new PowerCLI you get the following errors:

    Get-Datastore : Cannot validate argument on parameter ‘Datacenter’. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck\Plugins\52 Datastore Consistency.ps1:8 char:55
    + $Datastores = $VMHosts | Get-Datastore <<<<
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Get-Datastore : Cannot validate argument on parameter 'Datacenter'. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck\Plugins\52 Datastore Consistency.ps1:9 char:104
    + $problemDatastores = $VMHosts | ForEach {Compare-Object $Data
    stores ($_ | Get-Datastore <<<< )} | ForEach {$_.InputObject} | Sort Name | Sel
    ect @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Compare-Object : Cannot bind argument to parameter 'ReferenceObject' because it
    is null.
    At C:\vCheck\Plugins\52 Datastore Consistency.ps1:9 char:72
    + $problemDatastores = $VMHosts | ForEach {Compare-Object <<<<
    $Datastores ($_ | Get-Datastore)} | ForEach {$_.InputObject} | Sort Name | Sel
    ect @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Compare-Object], ParameterBind
    ingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.CompareObjectCommand

    Get-Datastore : Cannot validate argument on parameter 'Datacenter'. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck\Plugins\52 Datastore Consistency.ps1:8 char:55
    + $Datastores = $VMHosts | Get-Datastore <<<<
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Get-Datastore : Cannot validate argument on parameter 'Datacenter'. The argumen
    t is null or empty. Supply an argument that is not null or empty and then try t
    he command again.
    At C:\vCheck\Plugins\52 Datastore Consistency.ps1:9 char:104
    + $problemDatastores = $VMHosts | ForEach {Compare-Object $Data
    stores ($_ | Get-Datastore <<<< )} | ForEach {$_.InputObject} | Sort Name | Sel
    ect @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Compare-Object : Cannot bind argument to parameter 'ReferenceObject' because it
    is null.
    At C:\vCheck\Plugins\52 Datastore Consistency.ps1:9 char:72
    + $problemDatastores = $VMHosts | ForEach {Compare-Object <<<<
    $Datastores ($_ | Get-Datastore)} | ForEach {$_.InputObject} | Sort Name | Sel
    ect @{N="Datastore";E={$_.Name}},@{N="Cluster";E={$Cluster.Name}} -Unique
    + CategoryInfo : InvalidData: (:) [Compare-Object], ParameterBind
    ingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
    icrosoft.PowerShell.Commands.CompareObjectCommand

    10:53:34 ..finished calculating Datastore Consistency by Robert Sexstone v1.1

    Attempted to divide by zero.
    At C:\vCheck\Plugins\71 Capacity Planning.ps1:12 char:131
    + $DasRealCpuCapacity = $cluv.Summary.EffectiveCpu – (($cluv.Summar
    y.EffectiveCpu * $cluv.Configuration.DasConfig.FailoverLevel)/ <<<< $cluv.Summa
    ry.NumEffectiveHosts)
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

    Attempted to divide by zero.
    At C:\vCheck\Plugins\71 Capacity Planning.ps1:13 char:137
    + $DasRealMemCapacity = $cluv.Summary.EffectiveMemory – (($cluv.Sum
    mary.EffectiveMemory * $cluv.Configuration.DasConfig.FailoverLevel)/ <<<< $cluv
    .Summary.NumEffectiveHosts)
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

    Attempted to divide by zero.
    At C:\vCheck\Plugins\71 Capacity Planning.ps1:12 char:131
    + $DasRealCpuCapacity = $cluv.Summary.EffectiveCpu – (($cluv.Summar
    y.EffectiveCpu * $cluv.Configuration.DasConfig.FailoverLevel)/ <<<< $cluv.Summa
    ry.NumEffectiveHosts)
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

    Attempted to divide by zero.
    At C:\vCheck\Plugins\71 Capacity Planning.ps1:13 char:137
    + $DasRealMemCapacity = $cluv.Summary.EffectiveMemory – (($cluv.Sum
    mary.EffectiveMemory * $cluv.Configuration.DasConfig.FailoverLevel)/ <<<< $cluv
    .Summary.NumEffectiveHosts)
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

    10:34:52 ..finished calculating QuickStats Capacity Planning by Raphael Schitz,
    Frederic Martin v1.3

    Any Ideas?

    Thanks M

  165. Hi there,

    I’ve made a little adjonction to the plugin 68 : Disk Max Total Latency.

    As I’ve said earlier, when running this script some errors were displayed in the PowerCli shell. After searching, I’ve found that my vCenter isn’t collection data for some of my ESXi servers.
    So I’ve upgraded this script to include such case. It’s just a little try / catch and the script will show in red the hosts with no stats.


    # Start of Settings
    # Disk Max Total Latency Settings in Milliseconds
    $diskmaxtotallatency ="50"
    # Disk Max Total Latency range to inspect (1-24)
    $stattotallatency =" 24"
    # End of Settings

    $HostsDiskLatency = @()
    foreach ($VMHost in $VMH | ?{$_.ConnectionState -eq "Connected"}) {
    if ($VMHost.Version -lt 4){continue}# not an esx 4.x host
    $HostDiskLatency = @()
    $ErrorActionPreference = "stop"
    try {
    $VHHMaxLatency = $VMHost | get-stat -stat "disk.maxTotalLatency.latest" -start ($Date).addhours(-$stattotallatency) -finish ($Date)|?{$_.value -gt $diskmaxtotallatency}|sort Timestamp -Descending
    if ($VHHMaxLatency.Count -gt 0) {
    $Details = "" | Select-Object Host, Timestamp, milliseconds
    $Details.host = $VMHost.name
    $Details.Timestamp = $VHHMaxLatency[0].Timestamp
    $Details.milliseconds = $VHHMaxLatency[0].Value
    $HostDiskLatency += $Details
    if ($VHHMaxLatency.Count -gt 2) {
    $vmhlatid = [int]"1"
    while ($vmhlatid -cle $VHHMaxLatency.Count-2) {
    if (($VHHMaxLatency[$vmhlatid].timestamp).addminutes(5) -gt $Details.Timestamp -or ($VHHMaxLatency[$vmhlatid].timestamp).addminutes(-5) -gt $Details.Timestamp) { # keeps only high values strictly 5 min to avoid flood period
    $Details = "" | Select-Object Host, Timestamp, milliseconds
    $Details.host = $VMHost.name
    $Details.Timestamp = $VHHMaxLatency[$vmhlatid].Timestamp
    $Details.milliseconds = $VHHMaxLatency[$vmhlatid].Value
    $HostDiskLatency += $Details
    }
    $vmhlatid++
    }
    }
    }
    } catch {
    $Details = "" | Select-Object Host, Timestamp, milliseconds
    $Details.host = "" + $VMHost.Name + ""
    $Details.Timestamp = "Error Collecting Statistics"
    $HostDiskLatency += $Details
    }
    $HostsDiskLatency += $HostDiskLatency
    }

    $HostsDiskLatency

    $Title = "Disk Max Total Latency"
    $Header = "Disk Max Total Latency over $diskmaxtotallatency"
    $Comments = "Check vm per LUN dispatch and esxtop for very high values over $diskmaxtotallatency"
    $Display = "Table"
    $Author = "Raphael Schitz, Frederic Martin"
    $PluginVersion = 1.1
    $PluginCategory = "vSphere"

  166. @Alan
    Thanks for all the info and for pointing me in the right direction. I’ll submit the plugin if all goes well so that it can be included in future vChecks. 🙂

  167. Thank you Alan. I am sure you will get it resolved.. 🙂

    p.s. I love this site btw. So it is no way a reflection on the work you provide to the community.

    Keep up the great work.

  168. Ok – how do we unsubscribe?? No offense agaist quaality posts but i need to do some house keeping. Either I write a rule (which I dont want to ) or unsibscribe and check back regulary.

    Also folks that post nothing or a simple period is a waste of time for me to read.

    for this post i put in a ficticious email address so I can get my kind message across

  169. @Alan
    Any help or guidelines with setting up my suggested hardware change plugin earlier this week? I know all the data is available from vCenter, just need some assistance in bundling it all up in a plugin.
    Would be greatly appreciated. 🙂

    1. Kenny, unfortunately I dont have time to look into that plugin but if you ask on the PowerCLI community you will probably get an answer which you can copy and paste into a plugin, I would start with the Get-ViEvent cmdlet and LucD.info has some great posts on how to use that.

  170. @David
    I think the easiest way to achieve this is to # out the commands from within the vCheck.ps1 script. Edit the vCheck.ps1 script, then find the following text “This report took”. At the beginning of this line insert a #
    The following three lines underneath should also have a # (4 in total)
    Save and close the vCheck.ps1 script and then run it. If at any point you’d like this included in your report again, then edit and remove these these changes.

  171. @Ben
    From what I understand, PowerCLI scripts that contain variables and functions should always run in one script. ie If your variables and functions are defined in script1.ps1 and script1.sp1 is run from the cmdlet window and the same variables are called in script2.ps1, then when you try to run script2.ps1 from the cmdlet window, PowerCLI will not recall the variables defined originally from script1.ps1. vCheck.ps1 has reference to all the variables defined in all the scripts. Try the following to resolve your issue. Create a blank script, call it Snapshot.ps1. Edit Snapshot.ps1 and add the function “Write-CustomOut” from the vCheck.ps1 script. This will prevent a pile of errors that will display on your cmdlet window. Under this function, copy each script code in the order Alan mentioned above, first the global script code, then the 00 Connection code, followed by the 02 Snapshot code. Save and close the Snapshot.ps1 script you just created and run it from the cmdlet window. You should get an output, because the variables and functions are defined and referenced in the same script, just like the vCheck.ps1 script is.

    1. @Kenny and @Ben, the functions dont need to run in 1 script, just one session, I normally bring it up in PowerGUI Script Editor and run it there so the variables and functions are resident in my session, you can then run each check individually and edit as needed.

  172. Not sure if this is normal behaviour or not but I’m getting different results when I run this tool from a standalone, physical device as opposed to a VM within a vCenter.

    To be precise, the standalone device reports on every Datacenter configured within the vCenter whereas the VM will only return results from the Datacenter in which it resides.

    If this is indeed normal, can the script be particularized to report on all (other) Datacenters when running from a VM managed by vCenter?

  173. Hum, no go still. If I ignore the customout bit it still says “unable to connect to vCenter, please ensure you have altered the vCenter server address correctly”

    If I run the globalvariables then type $server it shows blank so I’d guess that its not retaining the variable and then of course the connection script won’t finish.

  174. Hey Alan!

    Hum, I can definitely run it by copying just what I need however I can’t seem to run just 1 script if needed. I tried to run the 00 script first but it errors out with “write-customout” is not recognized as the name of a cmdlet, function, script file…. it then states it cannot connect to the server.

    I did try connecting manually first without luck and also tried running to global variables script first. Sorry still new to these scripts so probably missing something simple.

    1. Ben, ah ok, yeah try the globalvariables then 00 plugin, dont worry about the custom out bit and then your plugin, i forgot i moved some stuff out to make it more generic for other reports.

  175. Thanks for all of this, great stuff in here and very useful !!

    Quick question that I couldn’t find and answer for, apologize if its here somewhere. Is there a way to run just 1 plugin “one off” so say I would like to run mid day today and find out the snapshot info. Can I run the main vcheck.ps1 with variables to only run the 1 check or would I need to just copy it to a new folder and have just the 1 plugin? I tried some of the scripts but they couldn’t run on their own likely missing the global variables. I could modify but wondered if this already exists.

    thanks again!

    1. Ben, Exactly, you can either run the 00 connection script and then the individual plugin in the same session, this will give you an output in your Powershell session for that particular plugin or you can copy the folder and delete the other plugins you dont want, either way will work.

  176. I am using vCheck 6.15 and I am a bit confused by Datastores (Less than x% free) plugin result. It says that my datastore has CapacityGB of 110,08 and FreeSpaceGB od 799,75. Shouldn’t that be reversed?

  177. Hi, how do I disable “This report took ## minutes to run all checks.
    If I set to false or False it still reports time.
    Thanks

    $TimeToRun = $False

  178. Kenny: agree with you completely.. i have had trouble in the past with this.. few dumb guys would add HDDs to VMs and never use it to its max too… this would really be a good add 🙂

  179. Just switched over from vCheck v5 to v6. The plugins feature is very handy and customising the script is now effortless. Thanks Alan, and everyone else who has contributed to making this the best admin utility ever! Now, may I pick your brains for a second… Would it be possible to create a plugin that can display any hardware changes made to a VM between vChecks? (I run mine weekly, so the result should only show the last 7 days.) Especially CPU, MEM, adding of Hard Drives or disk space changes. This would really help admins monitor resource usage and allocation, along with troubleshooting VM performance issue when checking the report history on hardware changed.

  180. @Alan, no way it is just that i check the site every week for news, so i don’t need a notification email send everytime..

    So keep up the good work Alan !

  181. unsubscribe is not an option here i think ??
    Can’t unsubscribe here ?

    I can press “manage your subscripton” but i can’t unsubscribe there, can someone help me with this ?

    1. Thats not a bad idea, the 00 plugin could actually be written to present a nice GUI, i have also thought about a dynamic GUI for the configuration with an export and import feature but that may take a little time to develop 😉

  182. Thanks alot Phill and Alan..

    This makes work more simplier and yet fun to work with.. this is exactly what i wanted.. !! Awesome work !!

    Alan: Yes, i will mention the original work and credits in the new script.. will share it once its completed..

    Thanks alot 🙂

    Awesome work 🙂

  183. @Alan

    Fantastic release and updates man! Works beautiful.

    @Phil and Alan,

    Did you guys stop work on the exchange plug-in? I was stoked for that one..

    Thanks a ton both of you for all of the hard work!

  184. @Yohan

    Your prayers have been answered.

    I’ve just written the ultimate plugin (yes, plugin!) which configures plugins as active or disabled via a simple Windows GUI.

    It will be winging its way to Alan very shortly

  185. How do you unsubscribe from this thread? I click on Manage your subscriptions at the bottom of this thread but it just takes me to another site on your webpage with no way to unsubscribe. Alan can you take a look into this and see what’s wrong with the link? Thanks

  186. Plugin : 68 Disk Max Total Latency.

    I’ve find with the help of the script that 3 of my esx server wasn’t sending stat to vCenter. After googling a little, it seems that it’s a problem which is not so isolated. I’ve been able to correct this by remove the host and adding it again in the vCenter.

    As the problem is occuring time to times, and as I’m not as good as Powershell as I would like, I’m asking for help here. One thing which should be nice is that the script send alert when no stat is collected. Problem the command : $VMHost | get-stat return an error if stat are “broken”, and I don’t know if it’s possible to catch the error in PowerShell.

    I hope I was clear enought to describe the problem !

  187. Sybux,

    You’d save yourself a bit of grief if you renamed the datastore – I suspect that means moving everything off it, renaming, and moving back.

    At some point a human’s likely to get confused as to which datastore’s where 🙂

  188. Yohan,

    It should be possible to write a PS script which (for example) reads all plugins in Plugins directory with .ps1 and .ps1.disabled extensions and fill up a menu with a checkbox against each one. And then script the renaming of extensions according to the checkmarks.

  189. is it possible to allow the user to select the plugins he wants to run using some menu-driven approach??
    if yes.. then any ideas on how to go about it??

  190. @alan : i thought also, but as soon as I’ve change the variables, the error disapeared. Perhaps it’s something in my configuration of PS ?

  191. Plugin 64 Snapshots Oversize .

    I’m getting a little issue. In my vCenter, I got 2 Datacenters, and in those datacenter, there is datastore with the same name. Problem, when the scripts run in line : $dsb = Get-View (($ds | Get-View).Browser) it fails as there is more than 1 line.
    So question : is it possible to limit the search on the datacenter hosting the VM or stop and Warn user if there is more than one occurence of a datastore name ?

  192. Release 6.15 :

    there is a little error in plugin 00 Connection Plugin for vCenter

    at line 92, it should be :

    $alarmMgr = get-view $ServiceInstance.Content.alarmManager

    with a capital S at ServiceInstance.

    1. Sybux, are you kidding ? You do know that PowerShell doesn’t care about the case of a variable name ? or am i missing something here ?

  193. —- vCheck 6.15 released —-

    # v 6.15 – Added Category to all plugins and features to vCheckUtils script for Categorys.
    # v 6.14 – Fixed a bug where a plugin was resetting the $VM variable so later plugins were not working 🙁
    # v 6.13 – Fixed issue with plugins 63 and 65 not using the days
    # v 6.12 – Changed Version to PluginVersion in each Plugin as the word Version is very hard to isolate!
    # v 6.11 – Fixed a copy and paste mistake and plugin issues.

  194. In the plugins “63 Snapshots removed.ps1” and “65 Snapshots removed.ps1” the selection for the number of days on which to report was not implemented. I modified the Get-VIEvent command in both scripts into:

    Get-VIEvent -maxsamples $MaxSampleVIEvent -Start (Get-Date).AddDays(-$VMsNewRemovedAge)

  195. Oh I had another question, anyway to exclude specific DiskPaths aka say /boot from VMs with less than X MB ?

    Think its :

    19 Guests with less than X MB free.ps1

  196. I think it only prompted me once for my username and password. Whats odd though is my vcenter is using the same local windows userid\password even if it prompted me once it should be the same? my user is in the admin group as well as currently we don’t have AD.

  197. With vCheck 6.10, you can rename a plugin to something like “60 Powered Off VMs.ps1.disabled” and it will be ignored. Sometimes renaming is more convenient than deleting.

    Cheers,

    Phil

  198. HELP!

    I want to unsubscribe from the comments for this post.
    The “To manage your subscriptions or to block all notifications from this site, click the link below” does not take me anywhere I can see how to do so.

    Great script, but 500+ comments are filling my mailbox 😉

    thanks

  199. That is what I said, the Powered off VM’s took 21 minutes

    This report took 39.48 minutes to run all checks.
    The following plugins took longer than 30 seconds to run, there may be a way to optimize these or remove them if not needed
    01 General Information.ps1 51.77
    02 Snapshot Information.ps1 37.51
    27 VM Tools Issues.ps1 73.51
    32 VM CPU Percent RDY.ps1 134.83
    33 VM CPU Usage.ps1 299.53
    48 FindVmDiskFormat.ps1 74.28
    60 Powered Off VMs.ps1 1275.58
    63 Snapshot removed.ps1 59.26
    65 Snapshot created.ps1 51.27
    71 Capacity Planning.ps1 80.08

    1. Shane, Ahh yeah, I see. So if its an issue and you are not really interested in when VMs were Powered Off then I would remove that file from the plugins folder, thats the great thing about this script !

      That particular script does take a while gathering the events and sorting them out to find out when it was powered off.

  200. @Phil. You are right. I didn’t think of anything else than vSphere to use this script for. You can remove the
    if (-not $VIServer) { throw “VIServer parameter must be specified.”}
    line from my change. This will make the -VIserver parameter not mandatory.

  201. The script runs great for me – except the length of time. On one cluster, I only have 14 Datastores and 86 VM’s and it takes 21 minutes to query plugin 60, for powered off VM’s. The overall script taking 39 minutes, with the one step, 21 of those.

    1. There should be the plugin details at the bottom which tells you how long it takes, post them here and we can see which ones potentially need tuning.

  202. One thing I do see now is this though:

    10:19:42 AM ..finished calculating VCB/Veeam/NetBackup Garbage by Alan Renouf v1.1
    Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    At C:\scripts\vCheck\Plugins\41 vCenter Services.ps1:7 char:27
    + $Services = get-wmiobject <<<< -Credential $creds win32_service -ComputerName $VIServer | Where {$_.DisplayName -like "VMware*" }
    + CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

    10:19:42 AM ..finished calculating VC Services by Alan Renouf v1.1
    Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    At C:\scripts\vCheck\Plugins\42 Windows vCenter Error Event Logs.ps1:12 char:24
    + $WMI = @(Get-WmiObject <<<='” + $ConvDate + “‘”) | Where {$_.Message -like “*VMware*”} | Select @{N=”TimeGenerated”;E={$_.ConvertToDateTime($_.TimeGenerated)}},
    Message)
    + CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

    10:19:42 AM ..finished calculating Windows vCenter Error Event Logs by Alan Renouf v1.1
    Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    At C:\scripts\vCheck\Plugins\43 Windows vCenter Warning Event Logs.ps1:8 char:24
    + $WMI = @(Get-WmiObject <<<='” + $ConvDate + “‘”) | Where {$_.Message -like “*VMware*”} | Select @{N=”TimeGenerated”;E={$_.ConvertToDateTime($_.TimeGener
    ated)}}, Message)
    + CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

    1. James, did you run through the setup video ? It tells you that these scripts require access to the vCenter Windows machine and therefore you will be prompted for access the first time if your credentials which are passed through do not work. If they dont work it prompts you and saves these in the vCheck folder with a filename of Windowscreds.xml, if the credentials you entered the first time are wrong for your windows vCenter box then delete this file and try again.

  203. Robert,

    Nice, but it ignores the fact that the framework might be used in a non-vmware environment where the scripts aren’t checking a specific server by name.

    Alan’s got my Exchange 2010 examples which demonstrate this

    The Server parameter should be optional, not mandatory.

  204. I’ve just upgraded to release 6.10 but I get many errors :

    Get-View : Cannot validate argument on parameter ‘VIObject’. The argument is nu
    ll or empty. Supply an argument that is not null or empty and then try the comm
    and again.
    At C:\vCheck6\Plugins\64 Snapshots Oversize.ps1:33 char:28
    + $dsb = Get-View <<<< (($ds | Get-View).Browser)
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingVal
    idationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    You cannot call a method on a null-valued expression.
    At C:\vCheck6\Plugins\64 Snapshots Oversize.ps1:44 char:71
    + $taskMoRef = $dsb.Client.VimService.SearchDatastoreSubFolders_Ta
    sk <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    + CategoryInfo : InvalidOperation: (SearchDatastoreSubFolders_Tas
    k:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\vCheck6\Plugins\64 Snapshots Oversize.ps1:45 char:67
    + $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMw
    are.Vim.VIConvert]::ToVim($taskMoRef)))
    + CategoryInfo : InvalidOperation: (WaitForTask:String) [], Runti
    meException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    One other thing is that every is at twice ??

  205. I added the possibility to specify a vCenter server as a parameter to the vCheck script. To do this I modified vCheck.ps1 in the following way:

    I changed the first line of the script into:
    param ($VIServer, [Switch]$config, $Outputpath)
    if (-not $VIServer) { throw “VIServer parameter must be specified.”}
    $VISRV = $VIServer

    And I modified the line:
    . $GlobalVariables
    into:
    . $GlobalVariables -VIserver $VIServer

    I modified GlobalVariables.ps1 and inserted the following line at the beginning of the script:
    param($VIServer)

    And modified the line that starts with $Server into:
    $Server =$VIServer

  206. Found the issue. Seemed to be a split-path custom function I put in the profile at some point. I removed that and now its working normally. Sorry about that.

    Thanks

  207. Alan,

    PS C:\scripts> $Host.Version

    Major Minor Build Revision
    —– —– —– ——–
    2 0 -1 -1

    Running on Win7 x64

    PowerCLI C:\scripts> Get-PowerCLIVersion

    PowerCLI Version
    —————-
    VMware vSphere PowerCLI 5.0 build 435427
    —————
    Snapin Versions
    —————
    VMWare AutoDeploy PowerCLI 5.0 build 575
    VMWare ImageBuilder PowerCLI 5.0 build 575
    VMware License PowerCLI 5.0 build 395016
    VMWare vSphere PowerCLI 5.0 build 435427

    1. Sorry Yohan, yes please do use my script, I am pleased for anyone to re-use this structure so long as they keep a link to the original somewhere !

      Don’t forget to share your work with me if it can be shared and would be useful to others.

  208. Pingback: vCheck 6.10 update
  209. Still seeing something weird with the Path ??

    ———————————-

    PS C:\scripts\vCheck> ./vCheck.ps1
    Get-ChildItem : Cannot find path ‘C:\scripts\vCheck\Path’ because it does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (C:\scripts\vCheck\Path:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find path 'C:\scripts\vCheck\====' because it does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (C:\scripts\vCheck\====:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '1 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (1 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '2 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (2 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '3 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (3 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '4 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (4 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '5 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (5 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '6 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (6 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '7 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (7 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '8 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (8 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '9 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (9 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '10 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (10 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '11 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (11 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find drive. A drive with the name '12 ' does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (12 :String) [Get-ChildItem], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-ChildItem : Cannot find path 'C:\Plugins\' because it does not exist.
    At C:\scripts\vCheck\vCheck.ps1:64 char:25
    + $Plugins = Get-ChildItem <<<< -Path $PluginsFolder -filter "*.ps1" | Sort Name
    + CategoryInfo : ObjectNotFound: (C:\Plugins\:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

    Get-Content : Cannot bind argument to parameter 'Path' because it is an empty string.
    At C:\scripts\vCheck\vCheck.ps1:67 char:20
    + $file = Get-Content <<<< $GlobalVariables
    + CategoryInfo : InvalidData: (:) [Get-Content], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Get
    ontentCommand

  210. Alan and all the plugin authors, thanks for the update!

    Really glad the VMKernel warnings are back in 6.1.

    I have a few issues with the new version, running it in vSphere 4.1:

    The Missing ESX Patches.ps1 script runs 240 seconds and doesn’t produce output in the report.

    Storage IO Enabled script not reporting correctly, it shows all my datastores as not having it enabled and it is enabled.

    Snaps created and snapshots removed scripts report every single snapshot in the logs, not just 5 days worth….changing to 1 day didn’t help.

    Owen, as far as the e-mail to multiple people issue, I do go back and edit the setting to include parens around each recipient. The script initially includes parens around the group of addresses and not each address, and that doesn’t seem to work.

  211. The new version doesn’t appear to allow multiple email addresses to be listed in the $EmailTo parameter. In v5 we could have multiple addresses seperated by a single comma which doesn’t work in this new version. Is there a way to get this functionality back? Love the script by the way!

  212. Thanks for vCheck 6!!! I like the modular approach. I’ve been deep diving into PowerCLI for the past 3 months and your site along with the PowerCLI reference book have been a great learning source. I was able to update the snapshot report to get creator name successfully. Thanks for your hard work!!

  213. Hi Alan,

    I have been testing your script out for sometime now on my Test Lab…

    I wish to make few design changes in it and then possibly demo it to our organization’s internal Infrastructure Management Team..
    So i need your permision to use this script of yours as a template and possibly design something around it for our own internal use..
    Do note that this will, in no way be used for any monetory-like purposses…

    This will solely be used by our internal teams..

    Do let me know your thoughs on this..

    Thanks alot..

    Awesome work… 🙂

  214. I just ran the report an everything looks great except I don’t get results for vm’s created and the results for vm’s removed seems to be off. Any idea’s?

  215. I want to run this multiple times a day (management requesting it) – is there a way to add the time to the end of the HTML file so it keeps multiple files in the same directory, as I run it?

  216. Great script by the way I use it all of the time. I have a question about the VM(s) CPU above 90. Would it be possible to display the process on that machine that is above 90%? Here is the code that you can use to return the top process on the remote machine I just don’t know how to incorporate it into your vCheck script? Thanks

    $sample_interval_seconds = 1

    $num_procs = @(gwmi -co $compname -cl win32_processor).count

    $ctrs = (Get-Counter -computername $compname “\Process(*)\% Processor Time” -sampleinterval $sample_interval_seconds).CounterSamples | `
    where { $_.InstanceName -ne “_total” -and $_.InstanceName -ne “idle” } | sort-object CookedValue -desc

    $ctrs[0..0] | %{“$compname” + ” ” + $_.InstanceName + ” ” + [int]($_.CookedValue / $num_procs) + “%”}

    }

  217. Thank you Alan firstly for providing this script. While running it, I got a Warning: There were one or more problems with the server certificate:
    * A certification chain processed correctly, but terminated in a root certification which isn’t trusted by the trust provider.
    * The X509 chain is not valid due to an invalid time value, shuch as a value that indicates an expired certificate.
    * The certificate’s CN name does not match the passed value.

    The scripts continue with the Collecting part of things but doesn’t seem to go on with the plug-in. Would the certificate issue be the cause of it?

  218. In v6, I’ve noticed some weirdness with the snapshot size calculation. When I execute the code from the “02 Snapshot Information.ps1” file, I get the correct snapshot sizes, but the HTML file contains different (wrong) information. Everything else about the snapshot is correct, just the SizeMB is incorrect. It looks like you’re just taking that data and pushing it into the HTML file, so I don’t know where it might be breaking.

  219. Is there a way, to add to this script, to give you an inventory of the data stores? Basically, I want to know what VM’s, by name, live on each Data store in the infrastructure.

  220. Is it possible to add in the “Capacity Planner Info” section to also add in DataCenter Name to? with the cluster name .?

  221. Is there any plugin to let us know how long the VM has been running without someone logging onto it locally or by RDP?

  222. There also seems to be an issue with the HWversion plugin: $_.hwversion doesn’t seem to be a valid use of the property.

  223. I noticed that most of the headers in the report omit the actual value that they’re configured to report on. For instance: “Datastores (Less than % Free):” rather than “Datastores (Less than 20% Free):”.

    It seems that this is happening because the variable is defined after the header output. The simplest way I found to fix this is to move the “settings” section to the top of the plugin script.

    Hope that helps.

    -Jon

  224. Great scrit but i have a little problème.
    The first time i receveid the mail with .htm file.
    Then if i execute again i had an error:

    17:32:13 ..Sending Email
    Send-MailMessage : Impossible de valider l’argument sur le paramètre « Attachme
    nts ». L’argument est null ou vide. Indiquez un argument qui n’est pas null ou
    vide et réessayez.
    Au niveau de C:\Scripts\vCheck\vCheck.ps1 : 385 Caractère : 154
    + send-Mailmessage -To $EmailTo -From $EmailFrom -Subject “$VISRV vChec
    k Report” -SmtpServer $SMTPSRV -Body “vCheck attached to this email” -Attachme
    nts <<<

    ******************************************************

    Vcenter 2.5
    power shell v2
    power CLI 5.0.1

  225. Great script, however I am having one problem. To stop me from running the script against all the datastores on the network i have locked it down. By locking it down I mean that I have created a new user in Active Directory and have added this users as an administrator to the ESX hosts, folders, datastores and networks i want to pool. Everything is fine but for the datastores. I just will not gather data for me. I get this error when I run the script.

    Get-Datastore : 23/02/2012 5:19:41 PM Get-Datastore Object reference
    not set to an instance of an object.
    At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vCheck5\Global
    Variables.ps1:77 char:28
    + $Datastores = Get-Datastore <<<< | Sort Name
    + CategoryInfo : NotSpecified: (:) [Get-Datastore], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
    n.ViCore.Cmdlets.Commands.GetDatastore

    Now if I run the same script against one esx server with root authentication its fine. So I figure it must be something to do with permissions. Any ideas. I get this part right, im sorted!! its only the datastore that is giving me issues. Do I need to hardcode something?

  226. I am getting a StackOverflowException right after VM needing snapshot consolidation by Luc Dekens v1.0

    Any thought?

  227. @alan – thanks for this new version of vCheck, it’s awesome!

    @billywestbury

    I had the same problem, PowerCLI 4.1 reports in MB not in GB. So you need to change CapacityGB to CapacityMB and FreeSpaceGB to FreeSpaceMB in Datastore Information.ps1.

    Like this:
    $OutputDatastores = @($Datastores | Select Name, Type, CapacityMB, FreeSpaceMB, PercentFree| Sort PercentFree)| Where { $_.PercentFree -lt $DatastoreSpace }

  228. Love the script, we use it to report on multiple client vm environments.
    We have modded this into a daily, weekly, monthly report so we get only the information we want on a particular day.

    replace the first (param) line with
    param(
    [Switch]$config,
    $Outputpath,
    [parameter(Mandatory=$true)]
    [ValidateSet(‘Daily’,’Weekly’,’Monthly’)]
    $ReportType
    )
    then change this line:
    $PluginsFolder = $ScriptPath + “\Plugins\”
    to:
    $PluginsFolder = $ScriptPath + “\$ReportType\”

    (plus a few other tweaks to get the email subline line changed etc..)

    then make a Daily, Weekly, Monthly subfolder, and move the appropriate checks into each folder

  229. Thanks for the great script. Is there any plug in to have the output published on a Sharepoint site (SP 2010) instead of emailig it.

  230. @SomeITGuy

    The SMTP server you’ve specified isn’t letting the box you’re running the script on talk to it. Telnetting to port 25 on $SMTPSRV might give you a clue as to what’s going on.

  231. Seems like the free space check columns is backwards in the email report?
    Name Type CapacityGB FreeSpaceGB PercentFree
    esx02:internal VMFS 47.4833984375 69.5 68

  232. Alan,

    That was the problem, i still had CLI 4.0 installed along with 5.x. Removed both, rebooted reinstalled 5.x & it works now with the exception of this:

    4:56:55 PM ..Sending Email
    Send-MailMessage : Service not available, closing transmission channel. The server response was: 4.3
    .2 Service not available
    At C:\Users\myname\my documents\scripts\vmware\vCheck.ps1:385 char:19
    + send-Mailmessage <<<< -To $EmailTo -From $EmailFrom -Subject "$VISRV vCheck Report" -Smt
    pServer $SMTPSRV -Body "vCheck attached to this email" -Attachments $Filename
    + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailM
    essage], SmtpException
    + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage

  233. Love the new update, but I am still having an issue where the output doubles everything. example: I have 50 VMs in the Production environment and the output shows 100. Anyone else have this issue?

  234. Hi Steve,

    Alan’s working on it, and you’ll see what I meant soon when vCheck is updated. I keep sending Alan good/bad ideas, which might be delaying the release a little 🙂

    Basically, with the next release, the vSphere checks can be completely disabled (because the vSphere initialisation part is now in a plugin), allowing you to use the vCheck framework to check whatever you want, even in a non-VMware environment.

    I’ve had no problems with the email being sent here. It’s possible that your SMTP relay isn’t allowing connections from the box you’re running the script on.

  235. Hi Phil,

    excuse me if i sound totally green, but what do you mean in your comment about vSphere dependencies as follows:

    To remove vSphere dependencies from the core, EndScript.ps1 should not be part of the core, but the last-called plugin (e.g. “99 vSphere Cleanup.ps1″)

    Then the framework can be used for non-vSphere plugins in other, vSphere-free) environments.

    Three-digit plugin numbers numbered in increments of 10 might be a good idea too.

  236. Hi Al,

    Amazing script that even a newby to powercli like me can get his head around, is there an eta on the changes that Phil has submited. also having problems getting the email to send.

  237. @phil,

    All of that information you mention is awesome! That would be great phil. I would love to see all of that on top of the vcheck! I anxiousley await for it…

    🙂

  238. @kenny, I’d be interested to know what info people would want to get out of Exchange 2010. So far, I’ve just hacked a couple of scripts I already had because I could 🙂

    My proof-of-concept script listed Exchange 2010 databases, their sizes, amount of whitespace, number of mailboxes, average mailbox size, etc

    I’ve also got one showing replication statuses of DBs.

    1. Phil,

      Making the changes right now, thanks. Also some of the ones you and others have emailed me. The Exchange one is Awesome, exactly what I wanted people to do. Soon we will have an army of vChecks !

  239. @Alan:

    I downloaded the latest version of PowerCLI & installed, now getting even more errors:

    11:58:39 AM Adding Custom properties
    The term ‘New-VIProperty’ is not recognized as the name of a cmdlet, function, s
    cript file, or operable program. Check the spelling of the name, or if a path wa
    s included, verify that the path is correct and try again.
    At C:\users\myname\my documents\scripts\vmware\GlobalVariables.ps1:59 char
    :15
    + New-VIProperty <<<< -Name PercentFree -ObjectType Datastore -Value {
    + CategoryInfo : ObjectNotFound: (New-VIProperty:String) [], Comma
    ndNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    The term 'New-VIProperty' is not recognized as the name of a cmdlet, function, s
    cript file, or operable program. Check the spelling of the name, or if a path wa
    s included, verify that the path is correct and try again.
    At C:\users\myname\my documents\scripts\vmware\GlobalVariables.ps1:64 char
    :15
    + New-VIProperty <<<< -Name "HWVersion" -ObjectType VirtualMachine -Value {
    + CategoryInfo : ObjectNotFound: (New-VIProperty:String) [], Comma
    ndNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    11:58:39 AM Collecting VM Objects
    11:58:40 AM Collecting VM Host Objects
    11:58:40 AM Collecting Cluster Objects
    11:58:40 AM Collecting Datastore Objects
    11:58:41 AM Collecting Detailed VM Objects
    11:58:43 AM Collecting Template Objects
    11:58:43 AM Collecting Detailed VI Objects
    11:58:43 AM Collecting Detailed Alarm Objects
    11:58:44 AM Collecting Detailed VMHost Objects
    11:58:46 AM Collecting Detailed Cluster Objects
    11:58:46 AM Collecting Detailed Datastore Objects
    11:58:48 AM ..finished calculating General Information by Alan Renouf v1.0
    WARNING: Unable to populate snapshot size due to unsiffucient permissions.
    12:00:39 PM ..finished calculating Snapshot Information by Alan Renouf v1.0
    12:00:39 PM ..finished calculating Datastore Information by Alan Renouf v1.0
    12:00:39 PM ..finished calculating Map disk region event by Alan Renouf v1.0
    12:00:39 PM ..finished calculating Hosts in Maintenance Mode by Alan Renouf v1.0
    12:00:39 PM ..finished calculating Hosts Not responding or Disconnected by Alan
    enouf v1.0
    12:00:40 PM ..finished calculating Hosts Overcommit state by Alan Renouf v1.0
    Get-View : 2/10/2012 12:00:40 PM Get-View Invalid object specified for
    parameter Id – 'VMHostImpl'. Valid types are ManagedObjectReference and string.

    At C:\users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun P
    ath.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDevice
    Info.ScsiLun |Measure-Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx1.myco.com:VMHostImpl)
    [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.
    VimAutomation.Commands.DotNetInterop.GetVIView

    Get-View : 2/10/2012 12:00:40 PM Get-View Invalid object specified for
    parameter Id – 'VMHostImpl'. Valid types are ManagedObjectReference and string.

    At C:\users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun P
    ath.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDevice
    Info.ScsiLun |Measure-Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx2.myco.com:VMHostImpl)
    [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.
    VimAutomation.Commands.DotNetInterop.GetVIView

    Get-View : 2/10/2012 12:00:40 PM Get-View Invalid object specified for
    parameter Id – 'VMHostImpl'. Valid types are ManagedObjectReference and string.

    At C:\users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun P
    ath.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDevice
    Info.ScsiLun |Measure-Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx3.myco.com:VMHostImpl)
    [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.
    VimAutomation.Commands.DotNetInterop.GetVIView

    Get-View : 2/10/2012 12:00:40 PM Get-View Invalid object specified for
    parameter Id – 'VMHostImpl'. Valid types are ManagedObjectReference and string.

    At C:\users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun P
    ath.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDevice
    Info.ScsiLun |Measure-Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx4.myco.com:VMHostImpl)
    [Get-View], VimException
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.
    VimAutomation.Commands.DotNetInterop.GetVIView

    12:00:40 PM ..finished calculating Hosts Dead Lun Path by Alan Renouf v1.0
    12:00:43 PM ..finished calculating Created or cloned VMs by Alan Renouf v1.0
    12:00:43 PM ..finished calculating Removed VMs by Alan Renouf v1.0
    12:00:43 PM ..finished calculating VMs with over x vCPUs by Alan Renouf v1.0
    12:01:59 PM ..finished calculating VMs Ballooning or Swapping by Alan Renouf v1.

    12:01:59 PM ..finished calculating Invalid or inaccessible VM by Alan Renouf v1.

    12:02:01 PM ..finished calculating VMs restarted due to Guest OS Error by Alan R
    nouf v1.0
    12:02:02 PM ..finished calculating HA VMs restarted by Alan Renouf v1.0
    12:02:02 PM ..finished calculating Host Swapfile datastores by Alan Renouf v1.0
    12:02:03 PM ..finished calculating DRS Migrations by Alan Renouf v1.0
    12:02:03 PM ..finished calculating Cluster Slot Sizes by Alan Renouf v1.0
    12:02:04 PM ..finished calculating Guests with less than x MB by Alan Renouf v1.

    12:02:04 PM ..finished calculating ESXi with Technical Support mode or ESXi Shel
    enabled by Alan Renouf v1.0
    12:02:04 PM ..finished calculating ESXi hosts which do not have Lockdown mode en
    bled by Alan Renouf v1.0
    12:02:04 PM ..finished calculating Checking VM Hardware Version by Alan Renouf v
    .0
    12:02:05 PM ..finished calculating Checking VI Events by Alan Renouf v1.0
    Get-VirtualSwitch : A parameter cannot be found that matches parameter name 'Sta
    ndard'.
    At C:\users\myname\my documents\scripts\vmware\Plugins\24 vSwitch with les
    s than x Ports Free.ps1:13 char:35
    + $VMH | Get-VirtualSwitch -Standard <<<< | Sort NumPortsAvailable | Where {$_.
    NumPortsAvailable -lt $($vSwitchLeft)} | Select VMHost, Name, NumPortsAvailable
    + CategoryInfo : InvalidArgument: (:) [Get-VirtualSwitch], Paramet
    erBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.Comma
    nds.GetVirtualSwitch

    12:02:05 PM ..finished calculating Checking Standard vSwitch Ports Free by Alan
    enouf v1.0
    12:02:05 PM ..finished calculating VMs in inconsistent folders by Alan Renouf v1
    0
    12:02:05 PM ..finished calculating No VM Tools by Alan Renouf v1.0
    12:02:47 PM ..finished calculating VM Tools Issues by Alan Renouf v1.0
    12:02:48 PM ..finished calculating CD-Roms Connected by Alan Renouf v1.0
    12:02:49 PM ..finished calculating Floppys Connected by Alan Renouf v1.0
    12:02:49 PM ..finished calculating Single Storage VMs by Alan Renouf v1.0
    12:02:50 PM ..finished calculating NTP Name and Service by Alan Renouf v1.0
    12:04:03 PM ..finished calculating VM CPU %RDY by Alan Renouf v1.0
    12:07:14 PM ..finished calculating VM CPU Usage by Alan Renouf v1.0
    12:07:19 PM ..finished calculating Number of VMs per Datastore by Alan Renouf v1
    0
    12:07:19 PM ..finished calculating Host Configuration Issues by Alan Renouf v1.0
    12:07:28 PM ..finished calculating Host Alarms by Alan Renouf v1.0
    12:07:28 PM ..finished calculating VM Alarms by Alan Renouf v1.0
    12:07:28 PM ..finished calculating Cluster Configuration Issues by Alan Renouf v
    .0
    12:07:28 PM ..finished calculating Datastore OverAllocation by Alan Renouf v1.0
    WARNING: Unable to populate snapshot size due to unsiffucient permissions.
    12:09:17 PM ..finished calculating VCB/Veeam Garbage by Alan Renouf v1.0
    12:09:17 PM ..finished calculating VC Services by Alan Renouf v1.0
    12:17:01 PM ..finished calculating Windows vCenter Error Event Logs by Alan Reno
    f v1.0
    12:24:50 PM ..finished calculating Windows vCenter Warning Event Logs by Alan Re
    ouf v1.0
    12:25:00 PM ..finished calculating VMKernel Warnings by Alan Renouf v1.0
    You cannot call a method on a null-valued expression.
    At C:\users\myname\my documents\scripts\vmware\Plugins\45 VMs needing snap
    shot consolidation.ps1:11 char:40
    + $VM | where {$_.VMHost.ApiVersion.Split <<<< ('.')[0] -ge 5 -and $_.ExtensionD
    ata.Runtime.consolidationNeeded} |
    + CategoryInfo : InvalidOperation: (Split:String) [], RuntimeExcep
    tion
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\users\myname\my documents\scripts\vmware\Plugins\45 VMs needing snap
    shot consolidation.ps1:11 char:40
    + $VM | where {$_.VMHost.ApiVersion.Split <<<< ('.')[0] -ge 5 -and $_.ExtensionD
    ata.Runtime.consolidationNeeded} |
    + CategoryInfo : InvalidOperation: (Split:String) [], RuntimeExcep
    tion
    + FullyQualifiedErrorId : InvokeMethodOnNull

    You cannot call a method on a null-valued expression.
    At C:\users\myname\my documents\scripts\vmware\Plugins\45 VMs needing snap
    shot consolidation.ps1:11 char:40
    + $VM | where {$_.VMHost.ApiVersion.Split <<<< ('.')[0] -ge 5 -and $_.ExtensionD
    ata.Runtime.consolidationNeeded} |
    + CategoryInfo : InvalidOperation: (Split:String) [], RuntimeExcep
    tion
    + FullyQualifiedErrorId : InvokeMethodOnNull

  240. Hey Al
    Nice script, works great one question on the datastore usage should the capacity and free space columns have values in them? I just see the percent free column from my input value.

    Thanks

  241. Another change which would be very useful is to change the hardcoded email report

    -Subject “$VISRV vCheck Report”

    to use a variable which can be set in GlobalVariables.ps1 (or overridden in a plugin)

  242. I’ve emailed Alan my changes, complete with a sample plugin which reports on Exchange 2010 Database statistics (requires Exchange Management Shell for the Exchange 2010 snapin).

    My master plan revealed, to turn vCheck into an Exchange 2010 reporting tool :-p

  243. I’m on a roll here:

    Change line 64 to:

    $Plugins = Get-ChildItem -Path $PluginsFolder -filter “*.ps1” | Sort Name

    To make sure plugin loading is in a deterministic order.

    Another suggestion is to take everything out of GlobalVariables.ps1 after “# End of Settings” and put into a plugin named “00 vSphere.ps1”

    To remove vSphere dependencies from the core, EndScript.ps1 should not be part of the core, but the last-called plugin (e.g. “99 vSphere Cleanup.ps1”)

    Then the framework can be used for non-vSphere plugins in other, vSphere-free) environments.

    Three-digit plugin numbers numbered in increments of 10 might be a good idea too.

    I’ve tested the concept, and it works perfectly here.

  244. After checking my suggested change to vCheck.ps1, here’s what line 64 should be:

    $Plugins = Get-ChildItem -Path $PluginsFolder -filter “*.ps1”

    It’s a worthwhile addition.

    With it people can put in readme.txt files in their plugins directory, edit the plugins with editors which leave .bak files lying about, or rename plugins to disable them.

  245. There seems to be some problem in plugin: 08 Hosts Dead Lun Path.ps1
    It doesn’t check for Dead paths and I know I’ve got 2.
    The check on line 14 “if ((((Get-View $esxhost).configmanager.StorageSystem).StorageDeviceInfo.ScsiLun |Measure-Object).count -gt 0)”
    seems to always be 0 so always fail.
    I have no idea what the above is supposed to check so I can’t be any more help and my powershell skills is very limited.
    I’m running vSphere 4.1.

  246. I got a “Security Warning” error on every script in the plugins directory.
    Setting “set-executionpolicy unrestricted” did not help much.
    You can right click and “Unblock” each one of them to get them to run.
    That’s tedious on 41+ scripts so I downloaded Streams from (http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx) and ran “streams -d *.ps1 on the plugins directory and the base directory.

  247. @Alan, I’ve run the script a second time and now it’s running fine without errors. Was the problem due to first initialization ?

  248. Two things:

    1) I typically run the same script (with the same configuration, thresholds, etc) against six different VirtualCenter systems. vCheck5 allowed the name of the system to be passed in as an external parameter like this:
    ./vCheck5.ps1 vSpherePROD
    ./vCheck5.ps1 vSphereQA
    etc, etc… It seems I need to have multiple configuration files in order to do this now. Or am I missing something obvious? Is there a simpler way to continue my previous method?

    2) Would it be easy to include the duration of the script run time in the output of the report? For example, modify the line:
    “vCheck v6.0 by Alan Renouf (http://virtu-al.net) generated on WIN-2JMLGHB50FG”

    To instead read:
    “vCheck v6.0 by Alan Renouf (http://virtu-al.net) generated on WIN-2JMLGHB50FG in 132 minutes”

    I think these are both probably fairly easy to do, but I’m not much of a scripting guy, so would appreciate any feedback or advice. Thanks for all your hard work on this fantastic script!

    1. Michael,

      Ahh, i did remove that feature didnt I, I will make sure i put it back in 6.1 and also the time it took to run the script, sorry about that.

  249. Script runs but I get a lot of errors:

    WARNING: There were one or more problems with the server certificate:

    * The X509 chain could not be built up to the root certificate.

    * The certificate’s CN name does not match the passed value.

    2:37:08 PM Adding Custom properties
    The term ‘New-VIProperty’ is not recognized as the name of a cmdlet, function, script file, or operabl
    e program. Check the spelling of the name, or if a path was included, verify that the path is correct
    and try again.
    At C:\Users\myname\my documents\scripts\vmware\GlobalVariables.ps1:59 char:15
    + New-VIProperty <<<< -Name PercentFree -ObjectType Datastore -Value {
    + CategoryInfo : ObjectNotFound: (New-VIProperty:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    The term 'New-VIProperty' is not recognized as the name of a cmdlet, function, script file, or operabl
    e program. Check the spelling of the name, or if a path was included, verify that the path is correct
    and try again.
    At C:\Users\myname\my documents\scripts\vmware\GlobalVariables.ps1:64 char:15
    + New-VIProperty <<<< -Name "HWVersion" -ObjectType VirtualMachine -Value {
    + CategoryInfo : ObjectNotFound: (New-VIProperty:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Get-View : 2/9/2012 2:39:05 PM Get-View Invalid object specified for parameter Id – 'VMHostI
    mpl'. Valid types are ManagedObjectReference and string.
    At C:\Users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun Path.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDeviceInfo.ScsiLun |Measure-
    Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx1.myco.com:VMHostImpl) [Get-View], VimExcept
    ion
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.VimAutomation.Commands
    .DotNetInterop.GetVIView

    Get-View : 2/9/2012 2:39:05 PM Get-View Invalid object specified for parameter Id – 'VMHostI
    mpl'. Valid types are ManagedObjectReference and string.
    At C:\Users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun Path.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDeviceInfo.ScsiLun |Measure-
    Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx2.myco.com:VMHostImpl) [Get-View], VimExcept
    ion
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.VimAutomation.Commands
    .DotNetInterop.GetVIView

    Get-View : 2/9/2012 2:39:05 PM Get-View Invalid object specified for parameter Id – 'VMHostI
    mpl'. Valid types are ManagedObjectReference and string.
    At C:\Users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun Path.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDeviceInfo.ScsiLun |Measure-
    Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx3.myco.com:VMHostImpl) [Get-View], VimExcept
    ion
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.VimAutomation.Commands
    .DotNetInterop.GetVIView

    Get-View : 2/9/2012 2:39:05 PM Get-View Invalid object specified for parameter Id – 'VMHostI
    mpl'. Valid types are ManagedObjectReference and string.
    At C:\Users\myname\my documents\scripts\vmware\Plugins8 Hosts Dead Lun Path.ps1:14 char:17
    + if ((((Get-View <<<< $esxhost).configmanager.StorageSystem).StorageDeviceInfo.ScsiLun |Measure-
    Object).count -gt 0)
    + CategoryInfo : InvalidArgument: (mycoesx4.myco.com:VMHostImpl) [Get-View], VimExcept
    ion
    + FullyQualifiedErrorId : Core_GetVIView_TryGetIdParam_InvalidValue,VMware.VimAutomation.Commands
    .DotNetInterop.GetVIView

  250. Simplest fix for the disabled plugins issue would be to change vCheck.ps1 line 64 to

    $Plugins = Get-ChildItem -Path $PluginsFolder -Include *.ps1

    That way, any renamed plugin or editor backup files won’t be included

  251. Alan, I’ve just unzipped and run the script. I’ve entered my vCenter hostname as an FQDN. I know that every time I connect I got a SSL warning (which is quite normal) but the other errors ?

  252. One usecase for disabling plugins is to test new plugins without having to wait for all the good working plugins to finish. 😉

    I will go for the disabled plugins folder.

    I’m working on converting some extensions that I made to vCheck v5 to plugins. I will mail you the ones that are not specific to our environment, when I’m ready.

    1. Maybe create a disabled plugins folder and move it out into there ? I just thought people would delete them to be honest. Why would you want to do this ?

  253. Hi Alan

    Thanks for a fantastic script, i have been running v5.0 daily for the last few years.

    I ran v6 today and in the datastore section the columns for CapacityGB and FreeSpaceGB looked to be the wrong way round.

    Thanks again.

    Billy

    1. Billy, do you have PowerCLI 5.0 installed by any chance ? This was a bug in that version of PowerCLI, it has been fixed in PowerCLI 5.0.1

  254. I’ve just discovered your blog some days ago. Last night I’ve received the news about your vCheck. I’ve looked around and find it very usefull. So I’ve downloaded the zip file and run the config. During the process I’ve seen some errors :

    09:36:07 Connecting to VI Server
    WARNING: There were one or more problems with the server certificate:

    * The X509 chain could not be built up to the root certificate.

    You cannot call a method on a null-valued expression.
    At C:\Users\$heginfo\Desktop\vCheck6\GlobalVariables.ps1:48 char:70
    + $VIVersion = ((Get-View ServiceInstance).Content.About.Version).Chars <<<< (0
    )
    + CategoryInfo : InvalidOperation: (Chars:String) [], RuntimeExce
    ption
    + FullyQualifiedErrorId : InvokeMethodOnNull

    09:36:10 Adding Custom properties
    09:36:11 Collecting VM Objects
    09:36:12 Collecting VM Host Objects
    09:36:15 Collecting Cluster Objects
    09:36:16 Collecting Datastore Objects
    09:36:16 Collecting Detailed VM Objects
    09:36:21 Collecting Template Objects
    09:36:22 Collecting Detailed VI Objects
    09:36:22 Collecting Detailed Alarm Objects
    Get-View : Cannot validate argument on parameter 'VIObject'. The argument is nu
    ll or empty. Supply an argument that is not null or empty and then try the comm
    and again.
    At C:\Users\$heginfo\Desktop\vCheck6\GlobalVariables.ps1:85 char:21
    + $alarmMgr = get-view <<<< $serviceInstance.Content.alarmManager
    + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingVal
    idationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    09:36:22 Collecting Detailed VMHost Objects
    09:36:31 Collecting Detailed Cluster Objects
    09:36:31 Collecting Detailed Datastore Objects
    09:36:32 ..finished calculating General Information by Alan Renouf v1.0
    09:36:35 ..finished calculating Snapshot Information by Alan Renouf v1.0
    09:36:36 ..finished calculating Datastore Information by Alan Renouf v1.0
    09:36:36 ..finished calculating Map disk region event by Alan Renouf v1.0
    09:36:36 ..finished calculating Hosts in Maintenance Mode by Alan Renouf v1.0
    09:36:36 ..finished calculating Hosts Not responding or Disconnected by Alan Ren
    ouf v1.0
    09:36:40 ..finished calculating Hosts Overcommit state by Alan Renouf v1.0
    09:36:53 ..finished calculating Hosts Dead Lun Path by Alan Renouf v1.0
    09:37:07 ..finished calculating Created or cloned VMs by Alan Renouf v1.0
    09:37:08 ..finished calculating Removed VMs by Alan Renouf v1.0
    09:37:09 ..finished calculating VMs with over x vCPUs by Alan Renouf v1.0
    09:38:41 ..finished calculating VMs Ballooning or Swapping by Alan Renouf v1.0
    09:38:41 ..finished calculating Invalid or inaccessible VM by Alan Renouf v1.0
    09:38:56 ..finished calculating VMs restarted due to Guest OS Error by Alan Reno
    uf v1.0
    09:39:04 ..finished calculating HA VMs restarted by Alan Renouf v1.0
    09:39:04 ..finished calculating Host Swapfile datastores by Alan Renouf v1.0
    09:39:05 ..finished calculating DRS Migrations by Alan Renouf v1.0
    09:39:05 ..finished calculating Cluster Slot Sizes by Alan Renouf v1.0
    09:39:06 ..finished calculating Guests with less than x MB by Alan Renouf v1.0
    09:39:07 ..finished calculating ESXi with Technical Support mode or ESXi Shell e
    nabled by Alan Renouf v1.0
    09:39:20 ..finished calculating ESXi hosts which do not have Lockdown mode enabl
    ed by Alan Renouf v1.0
    09:39:20 ..finished calculating Checking VM Hardware Version by Alan Renouf v1.0

    09:39:20 ..finished calculating Checking VI Events by Alan Renouf v1.0
    09:39:21 ..finished calculating Checking Standard vSwitch Ports Free by Alan Ren
    ouf v1.0
    09:39:21 ..finished calculating VMs in inconsistent folders by Alan Renouf v1.0
    09:39:21 ..finished calculating No VM Tools by Alan Renouf v1.0
    09:39:32 ..finished calculating VM Tools Issues by Alan Renouf v1.0
    09:39:36 ..finished calculating CD-Roms Connected by Alan Renouf v1.0
    09:39:40 ..finished calculating Floppys Connected by Alan Renouf v1.0
    09:39:41 ..finished calculating Single Storage VMs by Alan Renouf v1.0
    09:39:42 ..finished calculating NTP Name and Service by Alan Renouf v1.0
    09:39:43 ..finished calculating VM CPU %RDY by Alan Renouf v1.0
    09:39:45 ..finished calculating VM CPU Usage by Alan Renouf v1.0
    09:39:48 ..finished calculating Number of VMs per Datastore by Alan Renouf v1.0
    09:39:48 ..finished calculating Host Configuration Issues by Alan Renouf v1.0
    You cannot call a method on a null-valued expression.
    At C:\Users\$heginfo\Desktop\vCheck6\Plugins\36 Host Alarms.ps1:11 char:29
    + $alarms = $alarmMgr.GetAlarm <<<< ($null)
    + CategoryInfo : InvalidOperation: (GetAlarm:String) [], RuntimeE
    xception
    + FullyQualifiedErrorId : InvokeMethodOnNull

    09:39:48 ..finished calculating Host Alarms by Alan Renouf v1.0
    09:39:48 ..finished calculating VM Alarms by Alan Renouf v1.0
    09:39:48 ..finished calculating Cluster Configuration Issues by Alan Renouf v1.0

    09:39:48 ..finished calculating Datastore OverAllocation by Alan Renouf v1.0
    09:39:48 ..finished calculating VCB/Veeam Garbage by Alan Renouf v1.0
    09:39:50 ..finished calculating VC Services by Alan Renouf v1.0
    09:39:59 ..finished calculating Windows vCenter Error Event Logs by Alan Renouf
    v1.0
    09:40:02 ..finished calculating Windows vCenter Warning Event Logs by Alan Renou
    f v1.0
    09:40:22 ..finished calculating VMKernel Warnings by Alan Renouf v1.0
    09:40:22 ..finished calculating VMs needing snapshot consolidation by Luc Dekens
    v1.0
    09:40:22 ..finished calculating Missing ESX(i) updates and patches by Luc Dekens
    v1.1
    09:40:22 ..Displaying HTML results

    I don't know if it's "good" or "bad" but just in case. Of course if you need help to test again, no problem, I'm here.
    One other thing, in the report, I get some message in french (which is the language I use), but I'd like to know if it's possible to force to english which is always more understanding 🙂

    Thanks you for your really nice and usefull script.

    1. Sybux, This looks like an error with the initial connection somehow, did you alter the script manually or just follow the wizard and enter the IP/Hostname of your VIServer ?

  255. Yes, I’ve broken and re-signed the vCheck, globalsettings, and NTP scripts, but now I need only re-run the code signing script (after signing it once)! I’m going to use that thing all over the place.

  256. Alan,

    Yes, I ran that script on the c:\vCheck6 folder, it signs all the scripts in the vCheck6 folder and the plugins subfolder as well. Thanks for the tip. Note the script needs to have the path changed in two spots.

    -Rob

    1. Good to know, thanks. Now run the script with -config and change something in the wizard, I bet it breaks! You will probably have to sign it only after running through the wizard.

  257. New version: Get the error:

    The term ‘Get-Compliance’ is not recognized as the name of a cmdlet….

    Any ideas?

    1. Thanks, this check uses the VMware Update Manager Snapin for PowerShell which is a separate install to PowerCLI, I have updated the plugin to check for this snapin first.

      If you dont need that then please delete the check from the plugins folder, if you do want it then please download the VMware Update manager snapin from here: http://www.vmware.com/support/developer/ps-libs/vumps/

      Make sure you download the correct version depending on your Update manager Version, the Update Manager snapin is not backward compatible.

  258. Thanks for all your hard work, Alan. simply the best Powershell script out there for VMware.

    Generally I sign the vCheck script before I run it. But now I have all these plug-ins. Is there a command I can add to the Set-AuthenticodeSignature cmdlet to sign every plugin in the plugins folder? I know there must be an easy way, something like Get-Childitem *.ps1

  259. is It possible to have the Script to check Cluster compliance (HA/DRS) such as the Host Isolation Response setting. The reocommended Host Isolation Response setting is “Leave Powered on” so that the VM will be powered on when host failure occurred. It will be good if the script is able to verify this settings.

  260. Thanks for the excellent script — is there a way to pull annotations from the hosts which are in maintenance mode?

  261. at vSwitch Ports Check section my report is showing all my dvSwitches and at column “ports left” there are no values.

    1. Fred, Yes the dvSwitches dont have that property, I have changed this check in v6 to only look at standard groups, maybe another check will do the work for dvSwitches.

  262. Thanks Alan ! $ntpserver = “10.10.10.80|10.10.10.85″ working fine!

    At hardware version check section i had several VM´s listed although the report shows they are already on hardware version 8
    I changed Where {$_.HardwareVersion -ne “Version 7”} to Where {$_.HardwareVersion -ne “Version 8”}

  263. All charts are blank. Other info seems to be there. Any idea why charts are blank? I am using Office 2010.

    Thanks,
    Morrisos

  264. So the Creator portion of the Snapshots section is coming up blank since using this on vCenter 5 and PowerCLI 5. Is anybody else experiencing this and if so, is there are fix?

  265. Hi guys, i am new all to script, I have heard every one speak highly of this one, I have downloaded, but it is not working!! Please help, if any one got one with all these nice update I would much appreciate it

  266. Great script. have an issue where the output report has doubled everything. We have 9 hosts in one environment and the report finds 18 hosts? Any ideas??
    Thanks

  267. hello,

    the capacity planner for CPU on one datacenter is misreporting a negative number of available VMs since we restarted all nodes in the datacenter. Can anyone point me at what might be causing this / where in the script this is defined?

    ta
    martin.

  268. For some reason it is only showing linux guest with < 100mb of space left. It is not showing windows guest with , 100mb of space when I do indeed have a few. Is there something I am doing wrong with it perhaps?

  269. Hi Alan
    very nice script – thanks a lot for sharing
    I got one question …
    I configured the script so that it only monitors the really serious issues.
    What can I do so that it does not send an email when none of the tables is populated and instead just silently exits ?

  270. just wanted to know, will this script work while providing multiple vCenter IPs…??
    .\vCheck5.ps1 vCenter01 vCenter02 vCenter03

  271. This is really some script.. great effort put into it.. and that shows.. awesome work guys… !!!

    cant wait for more

  272. Hi – I’m using vCheckv5 and have noticed that while under the General Details section there are 7 clusters reported (and a Get-Cluster from PowerCLI also shows 7 clusters) the vCheckv5 report only shows Capacity Planner Info for 4 clusters.

    Anyone else seen this issue?

  273. Hi – I am finding vCheckv5 is incorrectly flagging HW v8 as old in the “VMs with old Hardware” section.
    Easy enough to fix to support vSPhere new HW v8 –

    thanks as always

  274. @Alan (and @slaclair)–

    I have a version of the script with all of the depreciated properties fixed if you’d like me to send it. I did a find and replace on all the occurrences of Host and State until the script ran without throwing up any warnings – there were quite a few. I then grabbed a fresh copy from the site and merged in those changes.

    Figured it might save you some time.

  275. Hi Al – love your script. I’ve made a few modifications to your script to fit my environment, but this makes updating to new versions difficult.

    Would it be possible to add a section for identifying VMs that are not @ a particular memory reservation level?

    As a VSPP, I get charged for memory reservation which must be a minimum of 50% of Allocated RAM. The addition of VMs configured with zero reservation or @ more than 50% of allocated would eliminate my need for a separate script.

    Thanks for the great tool!

  276. hi Virtu-Al ,
    is it possible that we can export report generated by vcheck 5 into excel, if yes kindly guide how it can be done.

  277. This is fantastic art of work! Just wanted to add something I noticed, if there are lot of ESX hosts in the cluster the “LUN check” part of this report is not clearly visible. The LUN naa.ID’s overwrites the coloumns and it becomes messy. Is there any way to put a slider to move it to right. thanks.

  278. Hi Al,
    I want to be able to see what VM’s have updated tools, I have tried a few bits of code but want to add it to this script. Can you help?

  279. Upon executing I get warnings for depreciated properties, no deal breakers but items I figured it couldn’t hurt to bring to your attention for future releases.

    WARNING: ‘State’ property is obsolete. Use ‘ConnectionState’ instead

    It looks like it’s coming from the $MaintHosts =@ line (I currently have it open in notepad so I can’t get you a real line count at the moment.)

    Also

    WARNING: ‘Host’ property is obsolete. Use ‘VMHost’ Instead

    which appears to be coming from the $BALSWAP line

    Not a deal breaker, just something to look into

  280. >> It has ben suggested to us to have a limit
    >> of 30 VMs per host in our environment as a
    >> best practice.

    Let me guess – a hardware manufacturer made that suggestion? # of guest VMs is one of the last things I would measure. You are virtualizing your guest OS’s to better utilize your hardware (among other things) why would someone claim X number of VMs should be the best practice without examinging load and resources used. 30 of one type of guest on one type of host would be way too many … 30 of another type of guest on another type of host would be way too few. Can’t just throw out a number. Someone wants to sell more hardware.

  281. Puh it takes about +12 hours to complete – is that normal?

    20:50:15 Collecting VM Objects
    20:50:18 Collecting VM Host Objects
    20:50:21 Collecting Cluster Objects
    20:50:21 Collecting Datastore Objects
    20:50:22 Collecting Detailed VM Objects
    20:50:32 Collecting Template Objects
    20:50:33 Collecting Detailed VI Objects
    20:50:33 Collecting Detailed Alarm Objects
    20:50:34 Collecting Detailed VMHost Objects
    20:50:42 ..Adding General Summary Info to the report
    20:50:49 ..Checking Capacity Info
    21:16:28 ..Checking Snapshots
    08:37:33 ..Checking Datastores
    08:37:33 ..Checking for Map disk region event
    08:37:33 ..Checking Hosts in Maintenance Mode
    WARNING: ‘State’ property is obsolete. Use ‘ConnectionState’ instead.
    08:37:34 ..Checking Hosts Not responding or Disconnected
    08:37:34 ..Checking Hosts Overcommit state
    08:37:46 ..Checking Hosts Dead Lun Path
    WARNING: ‘LunPath’ property is obsolete. Use ‘Name’ instead (it holds the same
    value).
    08:39:02 ..Checking for created or cloned VMs
    08:39:28 ..Checking for removed VMs
    08:39:30 ..Checking for VMs with over 2 vCPUs
    08:39:30 ..Checking for VMs swapping or Ballooning
    WARNING: ‘Host’ property is obsolete. Use ‘VMHost’ instead.
    08:43:30 ..Checking invalid or inaccessible VM
    08:43:30 ..Checking HA VM reset
    08:43:38 ..Checking HA VM restart
    08:43:45 ..Checking Host Swapfile datastores
    08:43:45 ..Checking DRS Migrations
    08:43:52 ..Checking Cluster Slot Sizes
    08:43:54 ..Checking for Guests with less than 10 MB
    08:43:55 ..Checking for ESXi with Technical Support mode enabled
    08:44:21 ..Checking for ESXi hosts which do not have Lockdown mode enabled
    08:44:32 ..Checking VM Hardware Version
    08:44:32 ..Checking VI Events
    08:44:39 ..Checking VMs in Inconsistent folders
    08:44:39 ..Checking VM Tools
    08:44:39 ..Checking VM Tools Issues
    08:48:58 ..Checking for connected CDRoms
    08:50:04 ..Checking for connected floppy drives
    08:51:11 ..Checking Datastores assigned to single hosts for VMs
    08:51:14 ..Checking NTP Name and Service
    08:51:20 ..Checking VM CPU %RDY
    08:55:09 ..Checking VM CPU Usage
    09:19:45 ..Checking Number of VMs per Datastore
    09:19:50 ..Checking Host Configuration Issues
    09:19:50 ..Checking Host Alarms
    09:20:05 ..Checking VM Alarms
    09:20:05 ..Checking Cluster Configuration Issues
    09:20:05 ..Checking VC Services
    09:20:06 ..Checking VC Error Event Logs
    09:20:18 ..Checking VC Warning Event Logs
    09:20:26 ..Checking VMKernel Warnings
    09:20:43 ..Displaying HTML results
    09:20:44 ..Sending Email
    PowerCLI C:\it\vmware>

  282. Is is possible to list how many VMs per host? It has ben suggested to us to have a limit of 30 VMs per host in our environment as a best practice. The script is great!

  283. Has anyone been able to exclude VMs from sections such as VMtools, CPU Ready?
    In VC we have a test cluster that suffers from lack resources and VMtools issues we’d rather not report on in vCheck.

  284. Is there a way to display the machine name and OS version by what datastore it belongs to? That would be nice addition to the report (at least I think it would be ) 🙂

    I think this would be helpful for folks that have a san that is cable to do perform deduplication on the datastores. If all virtual guests with same os version would belong in the same datastore this would greatly be a benefit for a deduplication thus getting storage space back. So syaing that if it was possible to list that then the admin can sprinkly the machines around to in the datastores accordingly.
    just a thought.. Perhaps a oneline command of sorts?

  285. Awesome script, already tweaked it a bit for our environment.

    One of the things im working on, though my posh’s isnt as clean as yours.

    -checking ESXi hosts for central logging enabled, and if not then displaying whatt local datastore is keeping the logs.(working on it)

    -Printing report directly to sharepoint (done)

    -find “NUMA” violators/problem VMs (not started)

    -how many smotions happen over a time period (not started)

    -Identify Luns using Fixed PSP (not started)

  286. Hi, have a question about the script.

    Does the VMs Created or Cloned (Last x Day(s) only show per month ?

    Cause i need a report of the previous month
    so on the last day of the month i collect with the script, but there is now info about created, removed vm’s in the list 🙁

    i have set it to the last 30 days to look for.
    And there where creations and deletion of vm’s in that month.

  287. Great Script, makes the daily checks thorough and consistent. Another nice feature could be to show a summary of VM Guest disk types: thin, thick. For our environment we thick everything on the VM side (SAN Array side it varies), so sometimes VM admins will create a thin disk not knowing. So this would essentially catch those configuration inconsistencies.

  288. The NTP-check always lists every host – but NTP-server is always correct and service running.
    Has anybody encountered that problem?
    Thx
    tranquilo

  289. I’m trying to run the script from my workstation to a vcenter server which is located on another non-trusted domain and I always get asked to provide user/pass (and then I can’t automate it with a scheduled task).
    I’ve provided the other domain’s credentials inside the script, but that didn’t help.
    Is there a way to achieve this?

    BTW – Great script, love it!

  290. Hey
    Can’t make the script run!

    error:
    File C:\temp\vCheck5.ps1 cannot be loaded. The file C:\temp\vCheck5.ps1 is not
    digitally signed.

  291. @ChrisSB

    I think I have a workaround that can fix the issue you are seeing in Outlook. If you find the line that looks like this:

    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport

    And change it a bit to look like this:

    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport.Replace(“class=”dsp “,”class=””)

    One of the style sheet headings will be removed in the email before it goes out. Outlook doesn’t properly render nested style sheets which causes this problem. The emailed output doesn’t look as good as the HTML file that is created, but it is much better than what you are seeing now.

    Hope it helps!
    @bwuch

  292. Hi All,

    Running Version 5.0

    Issue with Get-CustomHeader

    In Outlook its not displaying the Title or comments in the report. Any idea on what needs to change to correct this?

    And as it stands, the whole format and font layout is completely off in Outlook. I understand that this is most likely an M$ related issue in how Outlook’s HTML interpriter is defined, but I’m hoping that someone has tackeled this.

    Thanks,

    Chris

  293. getting Access Denied when the script is checking the following

    VC Error Event logs
    VC Warning event logs
    VC Services

    I’m even getting this Access Denied message with an account with full domain privilege

  294. Hi,

    I tried this script and ran into some truoble. I updated the smtp IP and the username/credentials. But when I run the script its just exists without showing any output.. The only output i receive is as given below (I am running the script from the VCenter Server itself – that is why I use the loopback IP – I tried with using the FQDN and the IP as well but same results):

    PS C:\Users\admin\Desktop\PowerCLI Scripts> .\vCheck5.ps1 127.0.0.1
    5:01:50 AM Connecting to VI Server
    PS C:\Users\admin\Desktop\PowerCLI Scripts>

    Can someone help me to find out whats wrong?

  295. Please could some explain what “VM with mismatch power custom fields/powerstate” is supposed to mean.

    All my VM’s are listed in this section.

  296. User column for Snapshots and VMs created, cloned and removed are blank on my reports. A bit of digging and I can see that the VIEvent.username property is set to “User” and not the actual username that created the VM, e.t.c.
    This was working. Not sure what has changed, I thought it might have been an upgrade from PowerCLI 4.1 to PowerCLI 4.1.1 but I have just uninstalled 4.1.1 and reinstalled 4.1 but still can not get the username from the VIEvent object.

  297. hi, use your script for reporting and i love it !

    I only miss some things:

    – patch levels (which patches installed) from esx server
    – CPU usage per esx server
    – MEM usage per esx server

    Is this simple to modify in your script ?

  298. Hi Alan, thanks for the script, it works great.
    I found it inconvenient that mem.swapped only gives you a high water mark – the same value every day. Since I can’t reboot servers every time they swap to reset the swapped value I changed the script in the VMs Swapping or Ballooning section to:
    (Get-Stat -Entity $_ -Stat mem.swapoutRate.average -Start (get-date).AddDays(-1) -Finish (get-date) -ErrorAction SilentlyContinue | measure-object value -max).Maximum
    This shows me if a VM has actually swapped during the last 24h.
    Just wanted to share that.

    Regards

    Tranquilo

  299. Where can I get PowerCLU? I am running PowerCLI 5.0 and just get a ton of errors when I try the script as I cant find a download of PowerCLU for PowerCLI 5?

  300. Looks like I was using the wrong function. Using the following basic cmdlet worked perfectly fine when trying to shutdown a VM with a specific value in a custom field:

    Get-VM | where {$_.CustomFields[“ShutdownDaily”] -eq “Yes”} | Shutdown-VMGuest -Confirm:$false

    Hope this helps anyone else wanting to do this.

  301. I’ve created a Get-CustomField function to output certain VMs with a specific value in a custom field:

    function Get-CustomField {
    param($item)
    foreach ($cf in $item.CustomFields) {
    if ($cf.Value) {
    $field = “” | Select Key, Value, EntityName
    $field.key = $cf.Key
    $field.Value = $cf.Value
    $field.EntityName = $item.Name
    Write-Output $field
    }
    }
    }

    Get-VM | Foreach { Get-CustomField $_ } | where {$_.value -eq “test”} | Out-GridView

    Now I would like to shutdown or start up these VMs with these values by using “Stop-VM” and “Start-VM” but it returns “The input object cannot be bound…” error. Is this possible using this function?

  302. NOT SHOWING VM’s ADDED and REMOVED?

    Hey Guys,

    The feature to show vm’s added and removed used to work. When I reinstalled my workstation and re-downloaded the script I am finding the other report functionality works correctly but it will not report on vm’s added or removed in X days. I have it set to 10. I’m not sure if this is somehow related to our VC setup or something in the script I am doing incorrectly.

    Any ideas?

  303. @jaap,

    Could you try running the following code from a powershell window to see if you get the email message? You’ll need to change the SMTP password, server, to/from addresses and the mydomain\username:

    $smtpPassword = “MySmtpPassw0rd” | ConvertTo-SecureString -asPlainText -Force
    Send-MailMessage -SmtpServer “smtp.mydomain.local” -From “test@mydomain.local” -To “me@mydomain.local” -Body “This is a test” -Subject “TEST” -Credential (New-Object System.Management.Automation.PSCredential(“mydomain\username”,$smtpPassword))

    If it works I can walk you through using the Send-MailMessage cmdlet in your existing vCheck script.

  304. Well, it took me a little while to get this to actually run, but its golden. Running this on my VC right now and hoping for some good detailed info. Still dont see graphs though…. : /

  305. Hi

    I realy like your script, but sending mail doesn’t work for me, i need autehntication
    i have the following

    function Send-SMTPmail($to, $from, $subject, $smtpserver, $body) {
    $mailer = new-object Net.Mail.SMTPclient($smtpserver)
    $msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
    $mailer.Credentials = New-Object System.Net.NetworkCredential(“xxxxxx@xxx.xxx”, “xxxxxxxx”);
    $msg.IsBodyHTML = $true
    $mailer.send($msg)
    }
    # Set the SMTP Server address
    $SMTPSRV = “xxxx.xxx.xxx”
    # Set the Email address to recieve from
    $EmailFrom = “xxxxxx@xxx.xxx”
    # Set the Email address to send the email to
    $EmailTo = “xxxxxx@xxx.xxx”

    I don’t have any experience with scripting, so i guess i do something wrong
    btw sendmail is true

    Regards

    Jaap

  306. @c0de1,

    Comment the following lines by prefixing them with a # sign

    Line 1562 = #if ($DisplayToScreen) {
    Line 1569 = #Invoke-Item $Filename
    Line 1570 = #}

    This will cause the script to export the file but not Invoke (open) the report.

  307. Hi,

    is it possible in a very simple way to let the output not go the screen or email but to a file on a specific location?

    love your script !

  308. Finally got this to run as a scheduled task, using local user account on Win2008R2. I also had the problem where it only reports 1 host.

    Changed the Connect-VIServer line to:
    $VIServer = Connect-VIServer $VISRV -cred $creds

    Changed the $SetUsername line to:
    $SetUsername = “Computer\localuser”

    Changed $CredFile line to:
    $CredFile = “C:\vCheck_Reports\vc_cred.txt”

    Pre-created the directory listed for CredFile, but do NOT create the file.

    Run the script as the user referenced as $SetUsername, it will prompt you, enter the name and password. Should be good to run as a task.

    Note that I cheated on a couple of things.

    first, I commented
    param( [string] $VISRV)

    and configured the vcenter in the config section
    $VISRV = “vCenter.domain.loc”

    second, I added this line right after the “Start of script” line:
    Add-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue

    Now my Task command is: powershell.exe

    and for arguments:
    -File “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\vCheck5.ps1”

    Hopefully that saves somebody some time!

  309. Couple of things I’ve noticed/modified (some already mentioned):

    — Missing reporting variables

    # Show overallocated datastores
    $ShowOverAllocation = $true
    # Show VCB snapshots left over
    $ShowVCBgarbage = $true

    — The email as attachment changes mentioned by someone above = perfect

    function Send-SMTPmail($to, $from, $subject, $smtpserver, $body, $attachment) {
    $mailer = new-object Net.Mail.SMTPclient($smtpserver)
    $msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
    $msg.IsBodyHTML = $true
    $attachment = new-object Net.Mail.Attachment($attachment)
    $msg.attachments.add($attachment)
    $mailer.send($msg)
    }

    # make sure DisplayToScreen is set to $true also
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV “vCheck report for $VISRV is attached” $Filename

    — Added checking for out-of-date tools in the $ShowTools section
    $NoTools = @($FullVM | Where {$_.Runtime.Powerstate -eq “poweredOn” -And ($_.Guest.toolsStatus -eq “toolsNotInstalled” -Or $_.Guest.ToolsStatus -eq “toolsNotRunning” -Or $_.Guest.ToolsStatus -eq “toolsOld”)} | Select Name, @{N=”Status”;E={$_.Guest.ToolsStatus}})

    — changed the VM disk space section to work on a percentage, not static size. One key thing (for this change and current code checking disk size in MB) is to re-sort the list after building before adding to report, as there is a bug with out-gridview and Get-HTMLTable when the first PSObject has less properties than later ones. Example of the code I use for percentage checking and the resorting is:

    # —- VM Disk Space – Less than x % —-
    If ($ShowGuestDisk){
    Write-CustomOut “..Checking for Guests with less than $PercFreeLimit %”
    $MyCollection = @()
    $AllVMs = $FullVM | Where {-not $_.Config.Template } | Where { $_.Runtime.PowerState -eq “poweredOn” -And ($_.Guest.toolsStatus -ne “toolsNotInstalled” -And $_.Guest.ToolsStatus -ne “toolsNotRunning”)}
    $SortedVMs = $AllVMs | Select *, @{N=”NumDisks”;E={@($_.Guest.Disk.Length)}} | Sort-Object -Descending NumDisks
    ForEach ($VMdsk in $SortedVMs){
    $Details = New-object PSObject
    $DiskNum = 0
    Foreach ($disk in $VMdsk.Guest.Disk){
    if ($disk.Capacity -ne 0){
    $PercFree = ([math]::Round((($disk.FreeSpace / 1MB)/($disk.Capacity/ 1MB))*100))
    } else {
    $PercFree = 0
    }
    if ($PercFree -le $PercFreeLimit){
    $Details | Add-Member -Name Name -Value $VMdsk.name -Membertype NoteProperty
    $Details | Add-Member -Name “Disk$($DiskNum)path” -MemberType NoteProperty -Value $Disk.DiskPath
    $Details | Add-Member -Name “Disk$($DiskNum)Capacity(MB)” -MemberType NoteProperty -Value ([math]::Round($disk.Capacity/ 1MB))
    $Details | Add-Member -Name “Disk$($DiskNum)FreeSpace(MB)” -MemberType NoteProperty -Value ([math]::Round($disk.FreeSpace / 1MB))
    $Details | Add-Member -Name “Disk$($DiskNum)%Free” -MemberType NoteProperty -Value $PercFree
    $DiskNum++
    }
    }
    if (($Details | get-member -membertype properties) -ne $null) {
    $Details | Add-Member -Name “ViolatingDiskCount” -MemberType NoteProperty -Value $DiskNum
    $MyCollection += $Details

    }

    }
    If (($MyCollection | Measure-Object).count -gt 0) {
    $MySortedCollection = $MyCollection | Sort-Object -Descending ViolatingDiskCount | Select * -exclude ViolatingDiskCount
    $MyReport += Get-CustomHeader “VMs with less than $PercFreeLimit % Free Space : $($MyCollection.count)” “The following guests have less than $PercFree % Free, if a guest disk fills up it may cause issues with the guest Operating System”
    $MyReport += Get-HTMLTable $MySortedCollection
    $MyReport += Get-CustomHeaderClose
    }
    }

    Script is excellent though, can’t wait for 5.1

  310. @Robert,

    Cmdlet works great, but when I added it to my report none of the object names are displayed under their specified headings. It shows “Object.System[]”. Any further help adding this in the report will be greatly appreciated.
    Thanks.

  311. hey guys,
    i’m trying to run this script as a scheduled task with a service user instead of my personal admin. scheduling works great acutally, but for some reason when i run the script with the service user, it keeps asking me for credentials at the following points:
    – “..Checking VC Services”
    – “..Checking VC Error Event Logs”
    – “..Checking VC Warning Event Logs”
    Even when i manually type in the credentials of the service user when promted, it seems that the service user is not able to capture those information. The service user has local admin rights on the vCenter server and administrator rights within vCenter (propagated).
    What am i missing? thanks for your help!

  312. Like clock work, I run this script regularly especially after adding the “LastPowerOn” section. Now however I am attempting to add a section naming the VMs and their current network adapter types. I am using this cmdlet “Get-VM | Sort Name | Get-NetworkAdapter”, but it does not display the VM name. Are there other cmdlets to produce these results?

  313. @Jorge Cruz,

    It doesn’t appear that I have any duplicate UUID’s in my environment, but I think the following code would show you all of the duplicates:

    $vmview = Get-View -ViewType VirtualMachine | Select @{Label=”VM Name”;Expression={$_.Config.Name}},@{Label=”VM UUID”;Expression={$_.Config.Uuid}}

    $vmview | Group-Object -Property “VM UUID” | Where-Object {$_.Count -gt 1} | %{ $myObj += $_.Group }

    $myObj | Sort “VM UUID”, “VM Name”

    Please let me know if it works out!

    Thanks,
    @bwuch

  314. Hello, excellent script, very good.
    I need a validate a UUID VM conflict (two o more VM with same UUID) … please review this feature report in next version …
    thks

  315. @wayvirtural,

    I had a problem sending mail from PowerShell at one point, but turned out to be a policy my antivirus guy had pushed down to prevent mass mailing worms. You can try this from a powershell window to see if you have a similar restriction:

    Send-MailMessage -SmtpServer “smtp.hello.com” -From “admin@hello.com” -To “test1@hello.com” -Subject “Test message” -BodyAsHtml -Body “This is a test message.”

    If you a message like this: “Send-MailMessage : Unable to connect to the remote server” you may have something like that going on too.

  316. Great script and thanks for sharing. however I am stuill unable to receive email. I can run the script and see the results on the broswer but just cant get email. Please Help!

    # Set the SMTP Server address
    $SMTPSRV = “smtp.hello.com”
    # Set the Email address to recieve from
    $EmailFrom = “admin@hello.com”
    # Set the Email address to send the email t
    $EmailTo = “test1@hello.com”

    # Use the following item to define if an email report should be sent once completed
    $SendEmail = $true

    # Use the following item to define if an email report should be sent once completed
    $SendEmail = $true

    if ($SendEmail) {
    Write-CustomOut “..Sending Email”
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport.Replace(“class="dsp ","class=“”)
    }

  317. @c0de1, I don’t believe the code is setup to limit reporting to a single datacenter. However, I have seen someone mention a clever work around that might help. If you create a user account that only has permissions to a single datacenter, and then run the vCheck using that account it will only include results from the datacenter it has permissions to read. Hope this helps!

  318. Hi, love your work !

    Is it possible to only make a report of a particulair datacenter?
    because we have multiple datacenters on out farm

  319. @Virtu-Al, I actually stumbled across that script already, and have had a play with it… finally got it to somewhat work, using the 32bit version of the PowerCLI run time, and it was producing graphs….

    Wont look at code too much, although I am a newbie to PS, so will look ok to me LOL

    You know what management are like, they want all the fluffy management reports, with pretty pictures ohh and of capacity predictions without the costs. So if I can automate something with powercli, powershell and the like then it gives me a nice missions on cutting my teeth with the whole environment.

  320. @Matt – you may want to check out veeam reporter, there is a free version of the tool that will suffice. It will also provide you with a visio diagrams of the infrastructure.

  321. @simon, this is why I am asking the questions, to find out if this tool is not suitable, what other options may be out there to get “graphical management reports” obviously without the cost associated with them.

    And you could go down the openxml document format for office 2007, that way you only require the framework to be installed I am led to believe?

  322. @matt – Why would you want that ? Its not that type of report really – its for people who support the environment. It would also mean people having to install office etc on whatever servers they use to monitor the environments.

    There are all kinds of tools for doing graphical management reports but this is a daily health check…

  323. Hey there, just wondering if there was any plans to make this write to a word doc or PDF form? and maybe adding some charts and stuff in? I know from a management point of view, they like the pretty pictures 🙂

    If you dont ask, you dont know right?

  324. @Pete L,

    This is a two part deal. Between lines 243 and 244 (right after “$msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)”) you’ll want to add something like this:

    $attachment = new-object Net.Mail.Attachment($Filename)
    $msg.attachments.add($attachment)

    This makes sure the file is attached to the email when it is sent. You’ll also need to make sure that the file you want to attach is actually created (normally only happens if $DisplayToScreen is set to $true, which you may not want for a scheduled task). You could also verify this happens if around line 1571 (right above the “if ($SendEmail)” line) you add code like this:

    $Filename = “C:\tmp\” + $VIServer + “vCheck” + “_” + $Date.Day + “-” + $Date.Month + “-” + $Date.Year + “.htm”
    $MyReport | out-file -encoding ASCII -filepath $Filename

    This will cause the Out-File command to execute even if the $DisplayToScreen is not enabled. The file will be created anyway — and then it will be available to attach to your message.

    Hope this helps!

  325. Great script. Is it possible to direct the output to a html file?
    run the script in a scheduled task that would essentially do this :

    vcheck5.ps1 myvcenter > myventer.html.

    This is different than the result just popping up in a new html window. I’d want this to run unattended while logged out. Then another script would ftp the myvcenter.html file up to an internal web site. Do this for all my vcenters and in this central web site, I’d have a dashboard where I could see today’s report for each vcenter. So all I need is for the html output to go to a file.

    thanks
    Roger

  326. #BUMP#
    I tried the file attachment changes mentioned to send the report as an attachment. Upon completion I would receive an embedded email report but no attachment.

    Any one else?

    hints? things to check?

  327. Al,

    What can I say! You are a God amongst Men. I have been using this excellent script since version 2 (I Think?)

    However, I feel I must point out an issue I am experiencing with the section reporting Triggered Alarms for VMs and Hosts. I ran your report which reported that there were no VMs with triggered alarms but later found that there were by trawling the VIEvent log. It seems to be that I (and maybe others) am experiencing a bug in PowerCLI (since your logic looks faultless to me).

    Your section is:

    # —- VM Alarm —-
    If ($ShowVMAlarm){
    Write-CustomOut “..Checking VM Alarms”
    $vmsalarms = @()
    foreach ($VMView in $FullVM){
    if ($VMView.TriggeredAlarmState){
    $VMsTriggeredAlarms = $VMView.TriggeredAlarmState
    Foreach ($VMsTriggeredAlarm in $VMsTriggeredAlarms){
    $Details = “” | Select-Object Object, Alarm, Status, Time
    $Details.Object = $VMView.name
    $Details.Alarm = ($valarms |?{$_.value -eq ($VMsTriggeredAlarm.alarm.value)}).name
    $Details.Status = $VMsTriggeredAlarm.OverallStatus
    $Details.Time = $VMsTriggeredAlarm.time
    $vmsalarms += $Details
    }
    }
    }

    However:
    $VMsTriggeredAlarm.alarm.value does not return any values nor indeed if you reference any property under $VMsTriggeredAlarm directly. Using $VMsTriggeredAlarm | fl * works though and $VMsTriggeredAlarm | gm shows the properties but direct reference does not work ?!?!?!?!?!?

    The only way I could get this to work was to perform a select on $VMsTriggeredAlarm to get access to the alarms and then your logic worked. BIZZARRE!!!

    The code I got to work is:

    # —- VM Alarm —-
    If ($ShowVMAlarm){
    Write-CustomOut “..Checking VM Alarms”
    if(!$alarms){
    $alarms = $alarmMgr.GetAlarm($null)
    $valarms = $alarms | select value, @{N=”name”;E={(Get-View -Id $_).Info.Name}}
    }
    $vmsalarms = @()
    foreach ($VMView in $FullVM){
    if ($VMView.TriggeredAlarmState){
    $VMsTriggeredAlarms = $VMView.TriggeredAlarmState
    Foreach ($VMsTriggeredAlarm in $VMsTriggeredAlarms){
    $Details = “” | Select-Object Object, Alarm, Status, Time
    $Details.Object = $VMView.name
    $Details.Alarm = ($valarms | where{$_.value -eq (($VMsTriggeredAlarm | select alarm).alarm.value)}).name
    $Details.Status = ($VMsTriggeredAlarm | select overallstatus).OverallStatus
    $Details.Time = ($VMsTriggeredAlarm | select time).time
    $vmsalarms += $Details
    }
    }
    }

    Have you seen this before or is this just me ?

    I’d appreciate your thoughts as this seems bonkers to me!

    Keep up the great work.

  328. I have come back to using vcheck5.3 after a couple months of not. I am finding now however that the vm’s removed/cloned/created is not reporting. This used to work and all other stats appear to show correct information on the report.

    Any ideas?

  329. @bwuch
    One word… – Brilliant!
    It worked like a bomb, not one glitch. I’m sure the code you gave would help many others that were looking for these type of results.
    Again, thank you very much. (***tipping my hat***)

  330. @bwuch,

    Any chance of incorporating the following code to allow for authenticated relay on smtp

    Add
    $SmtpUser = “servername”
    $SmtpPass = “password”

    Modify the Send-SMTPmail function to look like

    function Send-SMTPmail($to, $from, $subject, $smtpserver, $body) {
    $mailer = new-object Net.Mail.SMTPclient($smtpserver)
    $mailer.Credentials = [System.Net.NetworkCredential]::($smtpusername, $smtppassword)
    $msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
    $msg.IsBodyHTML = $true
    $mailer.send($msg)
    }

    Thanks

  331. @Thomas M,

    I did something around what you are looking for a little while back.

    Have a look here http://www.virtu-al.net/contact-me/ for my entry dated March 16th, 2011 – 12:11 item no 2

    Basically it was based on a percentile usage. let me know if that helps, code is a bit rough but should work.

    We use it along with the normal capacity planning stats to come up with a more accurate guess

    Thanks

  332. @Pete L,

    As a former storage admin, I can confirm that we never have problems with LUNs — the problem is always with the app owner 🙂 Anyway, the Dead Luns section shows dead paths between ESX and the LUN. This may not indicate a LUN issue and could show up if you have storage removed from your environment — the ESX host is looking for a LUN that no longer exists and assumes it is dead. In the past I have re-scanned HBA’s and had this error disappear.

    @Thomas M,

    The capacity section is calculated based off of statistics and HA fail over requirements. The numbers estimate the number of virtual machines you could run, under average load, accounting for your HA failover level. The numbers do not account for peak operation and I doubt you could actually run that number of virtual machines in your cluster — but it is pretty good in terms of a rough estimate.

  333. @Kenny,

    The code provided here (http://blogs.vmware.com/vipowershell/2009/10/when-was-the-last-time-that-vm-was-powered-on.html) is a function. For it to return anything, you’ll need to give it a VM object. For example you could run Get-VM | where {$_.PowerState -eq “PoweredOff”} | Get-LastPowerOn

    If you add the function into the vCheck and include something like the following code block, you should get a section that shows you what you are interested in:

    $guestDownTime = @()
    $vm | where {$_.PowerState -eq “PoweredOff”} | %{
    $Details = “” | select VM, PowerState, LastPowerOn, DiskGB
    $Details.VM = $_.name
    $Details.PowerState = $_.PowerState
    $Details.LastPowerOn = Get-LastPowerOn $_
    $Details.DiskGB = [math]::round($_.UsedSpaceGB, 2)
    $guestDownTime += $Details
    }
    if (($guestDownTime |Measure-Object).count -gt 0){
    $MyReport += get-customheader “Powered off VMs : $($guestDownTime.count)” “The following VMs are currently powered off and could possibily be relocated to slower storage or deleted if no longer required. The date/time of the most recent power on task is included for reference.”
    $MyReport += get-htmltable ($guestDownTime | sort LastPowerOn)
    $MyReport += Get-CustomHeaderClose
    }
    }

  334. Nevermind. It was the way I jacked with the script to ‘discover my hosts’

    Get-WmiObject -Computer MyDomainController -Namespace “root\MicrosoftDNS” -Class “MicrosoftDNS_AType”
    -filter "ContainerName='prod.mydomain.com'" | Select-Object ownername | where-Object {$_.ownername -like "*irv-dev-esxi*"} | Select Ownername |

    foreach-object{
    $VISRV = Connect-VIServer $server -credential $creds
    }

    I had put this before the functions so the ‘if ($VISRV -eq “”)’ didn’t fail. I guess powershell requires functions to be listed before they are called as opposed to vbscript since its not compiled at runtime?

  335. Has anyone gotten this to work without vCenter? I have 10 ESXi hosts and have no problem enumerating them via a DNS query, but when I go to connect, I either have to use

    Connect-ViServer -username -password, or I get prompted. If I try-

    $SetUsername = “root”
    $CredFile = “c:\data\dev\powershell\root.crd”
    $VISRV = Connect-VIServer $server -credential $creds

    I don’t get prompted (and it doesn’t work)

    Other than that, this is pretty frickin sweet for what I am trying to do, and I have been able to add other tables to give me a full breakdown of my environment.

    Any thoughts?

  336. does anybody know how the capacity section is calculated? i have run the report and it told me i have 168 (est num vm left cpu) and 87 (est num vm left mem). what exactly is this telling me. i could setup 87 1gb memory vm’s?

  337. Also Dead LUNS when I sent the report to the admin he would simply say ” I dont have any dead luns everything checks out fine…”

  338. I tried the file attachment changes mentioned to send the report as an attachment. Upon completion I would receive an email but no attachment.

    Any one else?

  339. I added limiting the scope to report only on a specific cluster, or hosts and/or VMs within a specific cluster. (I wanted to keep my various testing clusters out of the mix.)

    Write-CustomOut “Collecting VM Objects”
    If ($VMReportContainer -ne “”)
    { $VM = Get-VM -Location $VMReportContainer | Sort Name }
    Else
    { $VM = Get-VM | Sort Name }
    Write-CustomOut “Collecting Datacenter Objects”
    $Datacenter = get-datacenter | sort name
    Write-CustomOut “Collecting VM Host Objects”
    If ($HostReportContainer -ne “”)
    { $VMH = Get-VMHost -Location $HostReportContainer | Sort Name }
    Else
    { $VMH = Get-VMHost | Sort Name }
    Write-CustomOut “Collecting Cluster Objects”
    If ($ReportCluster -ne “”)
    { $Clusters = Get-Cluster -Name $ReportCluster | Sort Name }
    Else
    { $Clusters = Get-Cluster | Sort Name }
    Write-CustomOut “Collecting Datastore Objects”
    $Datastores = Get-Datastore | Sort Name

    Hope it helps someone with a similar need.

  340. Based on the $ShowLunPath section, i wrote this to add a check for “Fixed” or “RoundRobin” multipath policy for each lun. If the path for a lun is not “RoundRobin” it will triggers a warning.
    If you have decided to use this multipath policy it can be helpful.
    Could be add in a future version on this script.

    Need to add
    # RoundRobin
    $ShowRoundRobin = $true
    at the start..and

    # —- Round-Robin —-
    If ($ShowRoundRobin){
    Write-CustomOut “..Checking for Round-Robin on each LUN”
    $Fixed = @()
    foreach ($esxhost in ($VMH | where {$_.State -eq “Connected” -or $_.State -eq “Maintenance”}))
    {
    $esxluns = Get-ScsiLun -vmhost $esxhost -CanonicalName “naa.6006*”
    foreach ($esxlun in $esxluns){
    if ($esxlun.multipathpolicy -ne “RoundRobin”) {
    $myObj = “” |
    Select VMHost, Lunpath, MultipathPolicy
    $myObj.VMHost = $esxhost
    $myObj.Lunpath = $esxlun.CanonicalName
    $myObj.Multipathpolicy = $esxlun.multipathpolicy
    $Fixed += $myObj
    }
    }
    }
    If (($Fixed | Measure-Object).count -gt 0) {
    $MyReport += Get-CustomHeader “FIXED LUN Path : $($Fixed.count)” “Some path are not using Round-Robin policy.”
    $MyReport += Get-HTMLTable $Fixed
    $MyReport += Get-CustomHeaderClose
    }
    }

  341. @Mark T,
    In the vCheck5 code around line 1574 you’ll see a line that says:
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport
    If you do not want the report to appear in the body you can modify/replace the $MyReport variable with your desired message body HTML. An example would be:
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV “vCheck is complete”

    @Tracy M,
    Great solution on limiting the vCheck scanning scope. I’m still confused how PowerCLI is using the other linked mode instances — I want my vCheck to do that 🙂

  342. I found a way around my linked mode VCenter issue. And it should also work for those that only want to audit a certain segment (specific Datacenter, ESX Host) of their Environment. I created a local account on the Vcenter server that only has read-only access to the segments I want to be audited. For My environment since this local account only exists on the Primary Vcenter and not the linked ones, the audit cannot walk farther than the primary. Hope this helps someone else.

  343. Thanks for a great script but I’m after a little bit of help. I’ve managed to amend it slightly as suggested above to send the report as an attachment but now I’m trying to remove it from the body of the email. Any suggestions will be gratefully received.

    Thanks

  344. @Bwuch,
    I ran the latest script 5.38 and it took about 2hrs and 20 mins to run. That is a huge difference! I am used to over 6.

  345. @Pete L, just curious, do you have a lot of snapshots? If I’m reading the vCheck code correctly it may loop through nearly 1000 VI events for each snapshot (looking for the creation time and user name). If you have a lot of snapshots I could see that performing poorly.

    I do have a modified version of vCheck…which includes the new snapshot check code from the other day. If you would like to test it you can get a copy here: http://bit.ly/kKvxw1

    Oh, and yes, I do have a life and real job 🙂

  346. @Bwuch
    Hi first off thanks. I re-ran the vcheck 5.3 and about 6 hours later it emailed me a report. It just seems to take forever on the snapshot thing. Anyhow I finally had to kill that other job that was going for over 24hours and simply restarted it.

    Anyhow you mentioned you wanted to make changes? Anyhow I appreciate your time and attention to this as I can appreciate you have a life and a real job as well? 🙂

  347. @Kenny, it would be possible to add a section with all powered off VMs and the last time there was a power on event (I don’t see a way to determine the last time it was actually running). The code is already available here: http://blogs.vmware.com/vipowershell/2009/10/when-was-the-last-time-that-vm-was-powered-on.html — it just needs modified slightly so it fits into the vCheck framework.

    @Tracy M, I’ve ran vCheck against a vCenter Linked Mode configuration before and it only returned the one specific vCenter results (I was actually wanting to get all of them). If you run the PowerCLI cmdlet Get-PowerCLIConfiguration what is listed under the “Default Server Mode” heading? Two modes are available (single|multiple) — I’m just curious if that could allow you to report on more than one vCenter.

    @molski, the vCheck code can run against stand-alone ESXi hosts. However, some of the checks are not going to work (like the ones that look at the vCenter services and event logs). You could leave the checks running — since they return zero results they will not appear in the report. If you want to improve performance you may want to disable some of the inapplicable checks in the header section by chaning their status variable to $false. Here are a few of the ones I’d look for:

    # VC Service Details
    $ShowVCDetails = $true
    # VC Event Log Errors
    $ShowVCError = $true
    # VC Event Log Warnings
    $ShowVCWarn = $true

  348. @Pete L, if you try to change the references from ‘host’ to ‘vmhost’ or ‘state’ to ‘connectionstate’ in the code you’ll find that it is used in various places and requires multiple updates (I know because I’ve done it). Once you fix the first one the next time you run the script it will warn you in a different spot (the warnings appear to display only once per console window session). I’ve got a couple more changes I would like to incorporate and then I’ll share the version I have with this already addressed.

    Did you ever get past the snapshot check from yesterday? I’ve had blips in my network connection cause the script to appear to hang — and it usually doesn’t recover. I have an environment with about 900 VMs and 45 or so hosts and it only takes 2.5 hours to run the check. If the script is still hung from 5/13 7:23am I’d press CTRL+C to cancel and then try again. I’m not sure how large your environment is, but I’d hope the script doesn’t take 12 hours.

  349. UPDATE
    I took vcheck 5.3 and started running it yesterday (May 12) @ 4:44PM Eastern. Today is the day after and it is still running (I think) :
    4:44:08 PM Connecting to VI Server
    WARNING: There were one or more problems with the server certificate:

    * The X509 chain could not be built up to the root certificate.

    * The certificate’s CN name does not match the passed value.

    4:44:12 PM Collecting VM Objects
    4:44:16 PM Collecting Datacenter Objects
    4:44:16 PM Collecting VM Host Objects
    4:44:25 PM Collecting Cluster Objects
    4:44:25 PM Collecting Datastore Objects
    4:44:25 PM Collecting Detailed VM Objects
    4:45:00 PM Collecting Template Objects
    4:45:01 PM Collecting Detailed VI Objects
    4:45:01 PM Collecting Detailed Alarm Objects
    4:45:02 PM Collecting Detailed VMHost Objects
    4:46:20 PM ..Adding General Summary Info to the report
    4:46:33 PM ..Checking Capacity Info
    4:48:27 PM ..Checking Capacity Info (disk)
    4:48:59 PM ..Checking Cluster CPU ratio
    4:49:48 PM ..Checking Snapshots

    It has been sitting at Checking Snapshots since 4:49PM yesterday May12. I am posting this the next morning at 7:23AM.

  350. @bwuch (Brian),
    First off I want to say “thank you”. I ran the vcheck script in the the u1 version of PowerCli and about 6 hours later I got a report on our virtual environment.
    The only messages I saw in powercli were:

    12:58:56 PM ..Checking Hosts in Maintenance Mode
    WARNING: ‘State’ property is obsolete. Use ‘ConnectionState’ instead.
    12:58:56 PM ..Checking Hosts Not responding or Disconnected
    12:58:56 PM ..Checking Hosts Overcommit state
    12:59:32 PM ..Checking Hosts Dead Lun Path
    WARNING: ‘LunPath’ property is obsolete. Use ‘Name’ instead (it holds the same
    value).
    1:09:29 PM ..Checking for created or cloned VMs
    1:10:09 PM ..Checking for removed VMs
    1:10:10 PM ..Checking for VMs with over 2 vCPUs
    1:10:10 PM ..Checking for VMs swapping or Ballooning
    WARNING: ‘Host’ property is obsolete. Use ‘VMHost’ instead.

    I will assume i just change those values and I am good to go?

  351. Hi,

    Great script, but I also would like to use it on some ‘stand-alone ESXi islands’ (without VC).

    Any chance it can also work on a single ESXi host?

    Regards,
    Molski

  352. @bwuch:
    I upgraded powercli per your suggestion. Re-ran your code and within 7 minutes it provided me the results. No error messages!!!

    Thanks! Now does this code still need to be incorporated into the vcheck?

    p.s. as for the aging snapshots,… Yeah tell me about it.. Thus why I want to run this script and have it email the admins! 🙂 One admin has snapshots of over 200 days old in his 3.x environment. Now you can see why I want this script to function

  353. @Pete L — Holy cow! I get bent out of shape if someone asks to keep a snapshot more than 3 days…I’m not even sure what to say about a 60 day old/59GB snapshot!

    I do have some good news. I was able to re-create the warning message you see from an old PC I had with PowerCLI 4.0 U1 build 208462. Using the same user account/permissions on a different computer with PowerCLI 4.1 U1 build 332441 worked fine. Would it be possible to upgrade the PowerCLI version to 4.1U1 on your machine?

  354. @bwuch
    Ok here is an update from my comments above:
    ran your script again. And within 3 minutes I received the message :
    WARNING: Unable to populate snapshot size due to unsiffucient permissions.

    so I decided to do other things on the pc and see if results would magically appear again delayed sorta speak cause I do have the error message above but no prompt.
    Then about 15 minutes the results displayed:
    here is a small sample:

    VM : MACHINEAP03 – PDF Converter
    SnapshotName : Consolidate Helper- 0
    DaysOld : 60
    Creator :
    SizeMB : 59348.03
    Created : 3/12/2011 10:11:58 AM
    Description : Helper snapshot for online consolidate.

  355. Wait a minute!

    After I got that error I walked away from the PC when I came back it displayed virtual machine names with snapshot information..!!

    Hmm I am going to run again

  356. Bwuch,
    thanks for doing this.. However ran the script and got the following result after a few minutes:

    WARNING: Unable to populate snapshot size due to unsiffucient permissions.

  357. We have a primary Virtualcenter that is connected to 3 other virtualcenters in linked mode. When I run the script against the primary virtual center (and wanting it to just return the contacts of the primary) the script is crawling all of the linked VC’s as well and taking over an hour to finish. Is there a way to have it not crawl the linked VC’s or specify just the Datacenter you want it to inventory?

  358. @bwuch

    running get-vm |get-snapshot worked fine and provided me with output to the screen of the machines with snapshots.
    .
    So I am now puzzled.. 🙂 How can I get this to work when it runs it report in the script?
    I will be a happy man.. 🙂

  359. @Pete L,

    Here is another idea…the vCheck script is doing some fairly complex stuff with regard to snapshot size. Looking through the code I do not see any custom error messages related to permissions in the snapshot sections — which makes me believe that the error is produced by a native PowerCLI function. To simplify troubleshooting, can you try running the following command:

    get-vm |get-snapshot

    I also noticed that a newer version of PowerCLI was available (VMWare vSphere PowerCLI 4.1 U1 build 332441). The release notes do not mention fixes in Get-Snapshot, but it might be worth trying.

  360. I am not sure what else to try.. H’mmmm :
    10:53:17 AM Connecting to VI Server
    10:53:17 AM Collecting VM Objects
    10:53:24 AM Collecting VM Host Objects
    10:53:36 AM Collecting Cluster Objects
    10:53:37 AM Collecting Datastore Objects
    10:53:37 AM Collecting Detailed VM Objects
    10:54:12 AM Collecting Template Objects
    10:54:14 AM Collecting Detailed VI Objects
    10:54:15 AM Collecting Detailed Alarm Objects
    10:54:15 AM Collecting Detailed VMHost Objects
    10:55:39 AM ..Adding General Summary Info to the report
    10:55:59 AM ..Checking Capacity Info
    10:58:25 AM ..Checking Snapshots
    WARNING: Unable to populate snapshot size due to unsiffucient permissions.

  361. Hi. I already checked all of that but here is the result to post to the masses after running the version cmdlet: (as you can see I meet the version requirements)
    [vSphere PowerCLI] C:\> get-powercliversion

    PowerCLI Version
    —————-
    VMware vSphere PowerCLI 4.1 build 264274

    [vSphere PowerCLI] C:\>

    As for rights. I have all the required rights (admin)

  362. @Pete L,

    I’ve just tested the script and do not get the ‘insufficient permissions’ error message with a read-only vCenter user. I did find reports of this problem on the VMware Communities forum at http://communities.vmware.com/thread/251568?start=15&tstart=0. One of the suggestions in that thread is to verify the version of PowerCLI:

    Please verify that the latest build [of PowerCLI] is installed correctly: run Get-PowerCLIVersion cmdlet and verify the output is “VMware vSphere PowerCLI 4.1 build 264274”

  363. Brilliant script! Took about 6 hours to run, but the end result was spot on. Is there a way to incorporate within the report a section stating all powered off VMs and their Last Powered On date and time with the results in descending order, “oldest to most recent”?

    Any help with regards to this would be greatly appreciated.

  364. Hello – anyone have a solution for this. I am not certain what else to try..

    WARNING: Unable to populate snapshot size due to unsiffucient permissions

    thanks for reading. 🙂

  365. Hello Simon.
    I simply used the instructions provided and wondered why it did not work. So i just did what I did but thanks for the tip. However that is no longer concern of mine anymore as I am able to get by via the hard coding I did. I am running this script as a domain admin and I have full admin rights in vcenter.

    The next issue I wish to resolve is that pesky error with the snapshots. Insuffecient permissions”

  366. Pete L

    At the beginning of the script it starts “param( [string] $VISRV)”. So you pass the name of your management server to the script as a paramenter. That saves you having to change the script each time you run it against a different management server!!!

    What permissions role are you running the script as ? The easy solution is obviously to run it as an admin…

  367. Well – great script and I am sure many hours are poured into this and provided to the community. To that I say bravo. However I do not see many folks having any of their issues resolved. (perhaps I am mistaken)

    Anyhow I got past my issue with the the “Connect-VISERVER Cmdlet did not work, please check you VI Server”. Albeit perhaps not the best way but what I did is remove the variable $VISRV by simply hardcoding my virtual center server name in those 7 locations within the script. If I need to connect to another vcenter then I would change that name. I know not the best but I am no powershell expert when i was trying to debug it I kept getting messages saying that value is empty even though I typed my server name for it to connect.

    Now on to the following error:
    WARNING: Unable to populate snapshot size due to unsiffucient permissions.

    I see other folks asking but no solutions?? Has anyone got passed this????