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.

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 Clone the repo and check out the Example-Report.html in root

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

905 thoughts on “vCheck (Daily Report)

  1. Stu

    Hello, just wondering if vCheck is still usable and if it has been tested in vSphere 7.0? Just haven’t seen much posted online in the last few years.

  2. Viveka

    Hi Expert,
    I am new in PowerShell . I have trying to write a script on collecting Average of CPU & memory of Custer Wise with each 5 min interval under multiple VCenters.
    for example : out should be like
    VcenterName ClusterName CPUAvg MEMAvg TimeStamp
    Vcenter1 ABC001 4.7 42.3 20211123_000001
    Vcenter1 ABC002 4.5 42.3 20211123_000001
    Vcenter2 PQR002 3.9 39.8 20211123_000001
    Vcenter2 PQR003 3.2 40.2 20211123_000001
    Vcenter3 XYZ001 2.4 33.6 20211123_000001
    Vcenter1 ABC001 3.7 42.3 20211123_000600
    Vcenter1 ABC002 4.1 42.3 20211123_000600
    Vcenter2 PQR002 3.1 39.8 20211123_000600
    Vcenter2 PQR003 3.5 40.2 20211123_000600
    Vcenter3 XYZ001 2.9 34.2 20211123_000600
    Vcenter1 ABC001 4.7 42.3 20211123_000600
    Vcenter1 ABC002 4.5 42.3 20211123_000600
    Vcenter2 PQR002 3.9 39.8 20211123_000600
    Vcenter2 PQR003 3.2 40.2 20211123_000600
    Vcenter3 XYZ001 3.1 34.2 20211123_000600

    Here I am trying to write the script for same. please help me out

    # Import Modules
    Get-Module -Name VMware* -ListAvailable | Import-Module
    # Add PowerCLI Snap-in and PowerCLI Cloud Snap-in
    Add-PSsnapin VMware.VimAutomation.Core -Erroraction Silentlycontinue

    Enable-PSRemoting -Force
    #Vcenters host names under “Vcenters.txt”
    Connect-VIServer -Server ”Vcenterts.txt”
    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

    $clusters = get-cluster
    $myClusters = @()

    foreach ($cluster in $clusters) {

    $hosts = $cluster |get-vmhost

    [double]$cpuAverage = 0

    [double]$memAverage = 0

    Write-Host $cluster

    foreach ($esx in $hosts) {

    Write-Host $esx

    [double]$esxiCPUavg = [double]($esx | Select-Object @{N = ‘cpuAvg’; E = {[double]([math]::Round(($_.CpuUsageMhz) / ($_.CpuTotalMhz) * 100, 2))}} |Select-Object -ExpandProperty cpuAvg)

    $cpuAverage = $cpuAverage + $esxiCPUavg

    [double]$esxiMEMavg = [double]($esx | Select-Object @{N = ‘memAvg’; E = {[double]([math]::Round(($_.MemoryUsageMB) / ($_.MemoryTotalMB) * 100, 2))}} |select-object -ExpandProperty memAvg)

    $memAverage = $memAverage + $esxiMEMavg

    }

    $cpuAverage = [math]::Round(($cpuAverage / ($hosts.count) ), 1)

    $memAverage = [math]::Round(($memAverage / ($hosts.count) ), 1)

    $ClusterInfo = “” | Select-Object Name, CPUAvg, MEMAvg

    $ClusterInfo.Name = $cluster.Name

    $ClusterInfo.CPUAvg = $cpuAverage

    $ClusterInfo.MEMAvg = $memAverage

    $myClusters += $ClusterInfo

    }

    $myClusters | Export-Csv -Path .\Custerwise_AVGCPUMEM_Metics_$((Get-Date).ToString(“yyyyMMdd_HHmmss”)).csv -NoTypeInformation

  3. Alex

    Dear Sir :

    Great day to you,

    May i seek your advise how to run this script step by step?

    many thanks

  4. Gangadhar Raju

    Hi All, I have requirement to run vcheck report at one time on multiple vcenters with same credentials. Please let me what need to be added or modified in vcenter connections settings.

  5. Raju Banerjee

    Hi Alan
    That’s a great tools to get the infra health. I am using this for long time. With the current script, is there any way to get the datastore usege details irrespective of threshold. Since I am not getting any storage usage report unless its hit the threshold.

  6. Alan Post author

    In theory yes it could be adjusted to do so but it’s not planned by me so you would need to do the work

  7. nizamuddin

    Hi Alan,

    i am using you script since last 4 years, it’s very nice and useful.
    Just one query. It is possible instead of generating the HTML output can we generate the report in word or excel format.

  8. Ramesh Badam

    Hi Alan, Frederic,
    I have enabled ‘VMKernel warnings’ plugin and renamed the PS script file as well however I did not get the report output. Could you please advise how to enable this to get a report

  9. Troy Edwards

    Single Storage VM’s Plugin: Trying to use a wildcard (*) for certain local datastores, but fails everytime. Thoughts?

    parsing “*-INF-SPS00*” – Quantifier {x,y} following nothing.
    At C:\BIN\VCHECK\Plugins\60 VM\30 Single Storage VMs.ps1:20 char:52
    + … ere-Object {$_.Name -notmatch $LDSDoNotInclude -and -not $_.summary.m …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException

  10. Saaib

    The capacity Report, I dont understand what it represent.

    Estimated Num VM Left (MEM)

    What does this mean?

  11. Troy

    running this with powercli 6.5 R1 against vcasa 6.5 produce several errors. can you figure out what is the issue?

    —————————- 1
    Method invocation failed because [System.Object[]] does not contain a method named ‘op_Division’
    At D:\scripts\vCheck-vSphere-master\Plugins\20 Cluster\71 Capacity Planning.ps1:38 char:7
    + $VmCpuAverage = $CluCpuUsageAvg/($cluvmlist.count)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (op_Division:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

    —————————————— 2

    Exception calling “Add” with “2” argument(s): “Item has already been added. Key in dictionary: ‘HostSystem-host-58’
    Key being added: ‘HostSystem-host-58′”
    At D:\scripts\vCheck-vSphere-master\Plugins\60 VM\45 VMs needing snapshot consolidation.ps1:13 char:31
    + … ach-Object {$htabHostVersion.Add($_.MoRef,$_.config.product.version)} …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException

    ——————————————— 3

    Get-NetworkAdapter : The input object cannot be bound to any parameters for the command either because the command
    does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline
    input.
    At D:\scripts\vCheck-vSphere-master\Plugins\60 VM\200 VMs on ephemeral portgroup.ps1:13 char:7
    + $VM | Get-NetworkAdapter | Where-Object {$_.NetworkName -contains $Ep …
    + ~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (VMware.Vim.VirtualMachine:PSObject) [Get-NetworkAdapter], ParameterBin
    dingException
    + FullyQualifiedErrorId : InputObjectNotBound,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.GetNetwor
    kAdapter

  12. sokimex

    So this is my 2nd run with this script and for some reason the License portion of the report is not matching what is in Web client.

  13. usersc

    Yes I want to know is there any module or plugin to check the replication status of vm and also the xclarity critical alerts

  14. Aludden

    Is it just me or is anyone having issues with the credentials.xml file being saved while running with powercli 6.5 ?

  15. Hans

    Hey Alan, your suggestion for Adjusting connection information isnt working with the script version 6.25.

    I guess there’s a syntax error in the line.

    In your new script there is:
    $VIConnection = Connect-VIServer -Server $VIServer -Port $Port

    So, how is the correct syntax to fit in:
    $VIConnection = Connect-VIServer $VIServer –user “AlternateUsername” –Pass “Alternatepassword” –Protocol Https

    BR
    Han

  16. Alan Post author

    Sachin, on a jump host, I wouldn’t run it on the VC as it will take away valuable resources from the vCenter servers

  17. Sachin Dewan

    Can the vCheck report run from jump host that has connectivity to vcenter server OR has to be configured on the vCenter server?

  18. Mike

    Happy New Year All:
    I am having issues with the Scheduled Task only with VASA vCenter 6.5. My scripts have been working on all other versions with no issue. The issue only exists when running against vCenter 6.5. I can run the script manually via PowerCLI with no interruptions or issues, but the Scheduled Task just continues to run with no stopping in sight and nothing happens.
    Has anyone gotten the Scheduled Task to work with vCenter 6.5?
    Thanks,

    Mike

  19. Andy Miller

    Is there any plugin or module that vCheck will check hardware status as well? Something to notify about real hardware issues??

  20. shaik afroze

    From powercli ,how to create user , networkpool in vcloud director > kindly provide solution for this

  21. shaik afroze

    We have scale setup, while we are calling few queries like get-ciuser , Get-OrgVdc getting timed out as we have some 50000 users , is there any way can we call page wise . Kindly help me in solution

  22. tom

    Has this script been updated to work with versions => 6.0 and 6.5 and current versions of PowerCLI??
    From what the comments say, it appears not…??

  23. Nandeesh

    Hi Alan,

    Could help me in getting the credentials to add in the parameter

    $newPScreds = Get-Credential -message “Enter the NSX manager admin creds here:” $newPScreds | Export-Clixml nsxMgrCreds.xml

    can you give me example of it

  24. techtumbler

    I am using the EndScript.ps1 to rename and move the created files to the website location on an existing IIS Server. I use Port Switching and it works great. rename the file to index.html and move it to the needed location.

  25. AndrewL

    I am trying to send the vcheck report using my google apps settings:

    $SMTPSRV = “aspmx.l.google.com”
    # Would you like to use SSL to send email?
    $EmailSSL = $false

    But it is failing with this error:

    **Exception calling “Send” with “1” argument(s): “Service not available, closing transmission channel. The server
    response was: 4.7.0 [58.137.164.50 15] Our system has detected that this message is”
    At C:\Scripts\vCheck\vCheck.ps1:902 char:2
    + $smtpClient.Send($msg)
    + ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException**

    Does anyone know what I’m doing wrong here?
    I have try it with the port 25 selected and SSL set to true but it still fails.

  26. Howard

    Hello All ,

    May I know if we are going to setup the web page on IIS server , how

    should we do that since the htm name will be changed everytime

    Thanks

  27. Chris K

    Yes, I’m having issues with PowerCLI 6.5 as well. The script wasn’t completing fully since the upgrade, and attempt to fix it by starting from scratch is giving me headaches. When running it manually, it’s prompting me for my credentials on several of the scripts over and over, preventing me from having it work as a scheduled task again.

    I will most likely be submitting this as a bug on the GitHub site today.

  28. Erik Small

    It sort of works for me and I’m running 6.0 U2. I run into some issues with the ” 95 of 109 – uncontrolled snapshot mode” It just kind of hangs there a for a while. Not sure if it is me or the script that it is calling.

  29. Andres

    Hi,
    I am getting a couple of errors running the script:

    Get-NetworkAdapter : The input object cannot be bound to any parameters for the command either because the command
    does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline
    input.
    At D:\Scripts\vCheck-vSphere-master\Plugins\60 VM\200 VMs on ephemeral portgroup.ps1:5 char:8
    + ($VM | Get-NetworkAdapter | where {$_.NetworkName -contains $EphemeralPG} | Sele …
    + ~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (VMware.Vim.VirtualMachine:PSObject) [Get-NetworkAdapter], ParameterBin
    dingException
    + FullyQualifiedErrorId : InputObjectNotBound,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.GetNetwor
    kAdapter

    and:
    Get-VIEvent : Cannot bind parameter ‘Entity’. Cannot convert the “VMware.Vim.VirtualMachine” value of type
    “VMware.Vim.VirtualMachine” to type “VMware.VimAutomation.Sdk.Types.V1.VIObject”.
    At D:\Scripts\vCheck-vSphere-master\Plugins\70 Misc\108 SRM RPO Violations.ps1:45 char:77
    + $Events = Get-VIEvent -MaxSamples $MaxSampleVIEvent -Entity $RPO …
    + ~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-VIEvent], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEvent

  30. bwuch

    Hi @Marc, I can confirm this behavior when using PowerCLI 6.5. It is caused by a change from powershell snapins to modules in PowerCLI 6.5. You can resolve this by adding the following line between lines 53 and 54 in the Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1 file (right above the if statement checking for the snapins):
    Import-Module vmware.vimautomation.core -ErrorAction SilentlyContinue

  31. Marc

    vCheck isn´t working with PowerCLI 6.5 anymore. Downgraded to 6.3 and it´s working again. Can anyone confirm?

  32. Harish Kumar J

    Hi

    When i execute the script on my vsphere client installed on a remote system i get the below error

    ERROR 1:
    File C:\Users\IBM_ADMIN\Desktop\SRR\vCheck.ps1 cannot be loaded. The file C:\Us
    ers\IBM_ADMIN\Desktop\SRR\vCheck.ps1 is not digitally signed. The script will n
    ot execute on the system. Please see “get-help about_signing” for more details.
    .
    At line:1 char:13
    + .\vCheck.ps1 <<<<
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

    ERROR 2: after i set the execution policy to bypass mode
    The '<' operator is reserved for future use.
    At C:\Users\IBM_ADMIN\Desktop\SRR\vCheck.ps1:116 char:14
    + < <<<
    + CategoryInfo : ParserError: (<:OperatorToken) [], ParseExceptio
    n
    + FullyQualifiedErrorId : RedirectionNotSupported

    Question: what is the procedure to un-register the script
    Question: how to provide the smtp auth

    Thanks
    Harish

  33. David

    Hi,

    Very new to this, but I would like to run the vCheck script against me new VMware install (production) I started the script and it went through the setup but some of the questions looked like they were going to change the config of my server (NTP for instance) which I do not want it to. Am I miss reading this?
    Regards
    David

  34. vikrant

    Great article. I have really enjoyed your article. You show how to create vcheck report . It is really very helpful. I have done by the help of your article. I am using PowerCLI 5.0.1 and Its is working fine . Thanks for sharing .The way you explained each and everything is really great . Thanks once again .

  35. azizur rehman

    To power on all VMs on Venter or esxi, first connect to vcenter or esxi using powercli, type the command

    Get-VM | Start-VM

    For powering on only powered off VMs

    Get-VM | ?{$_.PowerState -eq “PoweredOff”} | Start-VM

    Hope this helps.

  36. Chris G

    Regarding the the Cisco UCS vCheck. The new version of the Cisco UCS power tool 2.02 has a change in the powershell module name: CiscoUcsPS is now Cisco.UCSManager. I updated this in my copy of the script, but you may want to update it or make note of it in the readme.

  37. Harry

    Keep the scripts and reports on your machine or setup a separate ‘automation’ server to keep all that information, you can then simply point the script to the vc appliance.

  38. krish

    can any body post how to powering on virtual machines using powershell script (automation process)

  39. Swifter

    No all. I was wondering if you can run individual. ps1 script files individually in Powershell and view the output In Powershell as well.
    Awesome tools.
    Thank you all from
    A Nub from Cali

  40. Brandon

    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.

  41. Chris Carmichael

    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.

  42. Brandon

    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)

  43. Sunil Patil

    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.

  44. Ernie

    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.

  45. Ram

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

  46. Ram

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

  47. venkat

    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

  48. GT

    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”

  49. Javed

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

  50. Javed

    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…

  51. Brandon

    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.

  52. Ravi

    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

  53. Krishna

    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

  54. Krishna

    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

  55. niklas

    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

  56. MSA

    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

  57. MSA

    This finally worked for me when I removed the *if (Get-…….. conditions at the top of the script file.

  58. Rosco

    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

  59. MSA

    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

  60. LauriN

    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!

  61. Matt Johnson

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

  62. Joey Catanzaro

    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.

  63. Jono

    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 🙂

  64. Brian Chandler

    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!

  65. James

    Nevermind. Found the issue. I hadn’t downloaded it all as a .zip and, thus, was missing the subfolders.

  66. Alan Post author

    Totally read only, this is more of a policy question, EG this script will search for any VMs that are above the allowed vCPUs

  67. MikeM

    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]:”

  68. Erick F

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

  69. Jono

    Hi Fredo

    I ran into this at a different plugin, it went away when I installed the latest (v5.5) PowerCLI.

  70. James

    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 ‘

  71. Jono

    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.

  72. Fredo

    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?

  73. Graham

    How would I change the port and set the smtp username and password for sending this via e-mail?

  74. dnwhittaker

    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?

  75. David Lister

    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.

  76. Erick F

    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.

  77. Mike

    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?

  78. Bill Pendleton

    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

  79. Alex

    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.

  80. Ali Kasim

    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

  81. Urs

    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 “\] “, “\”

  82. Dave Hill

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

  83. Michael Fuchs

    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

  84. Neil

    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?

  85. JayL_AKL_NZ

    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}}

  86. JayL_AKL_NZ

    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?

  87. Ali Sarreshteh

    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}}})

  88. Mandeep

    Hello,

    What are the minimum permissions required at VC ti run vCheck?

    Thanks
    Mandeep

  89. Michael J

    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.

  90. Bryan

    Has anyone done one of these for SQL server or IIS? I think these two additions would be widely used.

  91. nel5629

    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”

  92. Ali Sarreshteh

    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

  93. De-Mentor

    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.

  94. Alan Post author

    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.

  95. Haim Chibotero

    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

  96. Chandan

    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.

  97. Stefan

    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

  98. Karl-Heinz Hildebrandt

    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.

  99. Chris Lawrence

    @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!

  100. Alan Post author

    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!

  101. Gordon

    Module 79 currently has an issue – has a defined path for vm datastore instead of variables

  102. Chris Lawrence

    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.

  103. Sybux

    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.

  104. Randy

    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.

  105. elenezet

    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ô

  106. elenezet

    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 …

  107. michael.weigand@unnpp.gov

    I have the exact same issue. Did you ever get this resolved?

  108. nel5629

    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 🙂

  109. Michael

    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

  110. Matt

    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?

  111. Chris Jones

    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

  112. joe

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

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

    Thanks for the reply!
    -Joe

  113. Michael

    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?

  114. Chris Jones

    Could you create two separate accounts for use, one for each datacenter?

  115. Joe

    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

  116. Aswini

    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

  117. VM-Hiltron

    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.

  118. pedro

    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

  119. pedro

    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

  120. JD

    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

  121. Surya Kiran

    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

  122. Surya Kiran

    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

  123. --DigDug--

    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

  124. Skip Hong

    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.

  125. Nathan Hans

    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.

  126. Nathan Hans

    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.

  127. Randy

    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-

  128. Grant

    Ah – found the answer myself 🙂 – The function used in the plugin is available in PowerCLI 5.1

  129. Grant

    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.

  130. Cyril

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

  131. Mike

    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!!

  132. Greg

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

  133. Erik

    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

  134. Karuna

    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

  135. p3opl3sh3ro

    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”

  136. Cyril

    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.

  137. Cyril

    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 ?

  138. Cyril

    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

  139. Juan Machado

    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

  140. Edward

    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.

  141. JohnB

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

  142. Alex

    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?

  143. Todd

    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!

  144. Todd

    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

  145. Brandon Seymour

    Can someone help explain the Snapshot Oversize portion? I understand the VM is the name, the vmdkSize is the size of the vmdk, the OverSize though I dont understand.

  146. Craig Thompson

    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.

  147. Layne

    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

  148. Troy

    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

  149. David Rice

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

  150. Ron

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

  151. Bryan

    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\”
    }

  152. kenny

    @ 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

  153. ayanes21

    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

  154. kenny

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

  155. egs

    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.

  156. Dean

    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.

  157. Michael

    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

  158. Tom

    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

  159. Ethan Lowry

    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?

  160. Kevin Leek

    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?

  161. Lukas

    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.

  162. S

    Does this script work for monitoring a standalone ESXi 5 server and NOT connected to a vcenter server? thanks

  163. Craig Wallace

    Hello.

    Thanks for an amazing script. Quick question, i have multiple vCenter servers and would love to have them all report in one email. is this possible?

  164. Mike

    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?

  165. Rick

    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.

  166. Natesh

    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

  167. Hein

    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?

  168. Jonathan

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

  169. d_

    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.

  170. Damion S.

    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?

  171. Rick Ziminski

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

  172. Joe Doe

    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.

  173. Pete L

    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:

  174. ultan lankford

    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.

  175. Jeramey Wentz

    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 ?

  176. steven dillon

    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

  177. Graham

    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?

  178. Dave

    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

  179. Pat Allen

    @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

  180. Dave

    …also just figured out, I got the variables the wrong way round in that code DOH!

  181. Dave

    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…

  182. Dave

    @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) {
    ...
    ...
    ...

  183. Lance

    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

  184. Larry

    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!!!

  185. Samir

    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 ?

  186. Andrew Wroe

    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!

  187. Pat Allen

    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!

  188. Samir

    Hi Alan,
    Did you removed capacity planner in 6.15 version ????. It was available in V5?

  189. Sean

    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

  190. Rick

    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 }

  191. Rick

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

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

    Rick

  192. Craig

    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

  193. PaulSaunders

    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?

  194. Sebastian

    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

  195. PaulSaunders

    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.

  196. PaulSaunders

    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?

  197. Amalia

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

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

  198. Amalia

    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?

  199. Pat Allen

    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

  200. Dave

    “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).

  201. Ondrej

    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.

  202. KutuDigital

    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”

  203. razman

    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

  204. l8nighter

    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.

  205. Rick

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

  206. n00b

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

  207. Andrew

    Hi Ron,
    I don’t use Hyper-V at work or home but stumbled across this searching for ways to distinguish VMWare vm’s from Physical machines:

    Their script looks for services for either VMWare or Hyper-V. Are you looking to query for the hypervisor itself or the guest OS that is virtual?

    I really wish Microsoft would just put an attribute on the computer object in AD: “Virtual” and a value of either True or False. It would make life so much easier right now. I guess we could always create our own custom attribute and extend the AD schema but I’m afraid of screwing up my Production Network by customizing that.

  208. Ron

    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

  209. Alan Post author

    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

  210. Andrew Jones

    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.

  211. Andrew Jones

    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.

  212. Randy Redekopp

    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-

  213. Michael

    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.

  214. Micheal

    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.

  215. n00b

    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 ?

  216. Ross Worth

    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

  217. Rob

    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.

  218. hickwillie

    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!

  219. hickwillie

    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!!!

  220. Joe

    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?

  221. Michael

    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!

  222. Micheal

    It actually finished and has a lot of great info. It took 30 minutes to finish. Great script.

  223. Micheal

    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?

  224. Pingback: vCheck for Exchange | Lord PowerShell

  225. Dave

    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…

  226. steven dillon

    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.

  227. Ron

    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

  228. Steven

    Hi Chad,

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

  229. Alan Post author

    Chad,

    Awesome! Make sure you send it over to ajw.renouf@googlmail.com for me to check it out, would love to see a sample and create a post on these.

    BTW, I too use Gmail for my email and had to do the same thing 😉

  230. Chad Killion

    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.

  231. JohnB

    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.

  232. Seb

    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.

  233. MichaelEA

    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?

  234. Pingback: Manipulation de snapshots » vg5000.org

  235. Pingback: Segregating The vCheck Daily Report Scripts - Chris Colotti's Blog

  236. Ron

    Is there any way to determine (via Plugin) which VMs may be using Raw Device Mappings?

    Thx

  237. Ron

    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

  238. Shaun

    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

  239. Alan Post author

    Greg, You need to schedule it as a Windows Scheduled task, you can then define when it runs and when you receive the email.

  240. Greg Stuart

    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.

  241. Robert van den Nieuwendijk

    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.

  242. Ashraf

    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

  243. Vman

    Is there a way of running the plugs w/o getting the “do not run/run/suspend” prompt?

  244. Pingback: vCheck Exchange Updated | | Virtu-Al.NetVirtu-Al.Net

  245. Martin

    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.

  246. c0de1

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

  247. Ron

    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

  248. michael

    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.

  249. Mark Owen

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

  250. Mark Owen

    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

  251. Sybux

    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"

  252. Kenny

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

  253. Alan Post author

    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.

  254. Alan Post author

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

  255. Alan Post author

    David, looks like i forgot to make use of the $TimeToRun disable.. Doh ! I will make sure this is updated in the next release.

  256. Pete

    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.

  257. Alan Post author

    Pete, im sorry but the unsubscribe button for the plugin in wordpress doesnt seam to work, im looking into this.

  258. Pete

    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

  259. Kenny

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

  260. Kenny

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

  261. Kenny

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

  262. David

    How do I disable feature: timetorum “This report took ## minutes to run all checks”?

    Thanks

  263. Ron

    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?

  264. Ben

    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.

  265. Alan Post author

    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.

  266. Ben

    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.

  267. Alan Post author

    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.

  268. Ben

    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!

  269. MS

    Thanks Alan, it works as expected in PowerCLI 5.0.1 … I’ve had 5.0.0 installed before …

  270. Pingback: vCDAudit for vCloud Director | | Virtu-Al.NetVirtu-Al.Net

  271. Alan Post author

    MS, please can you check your using the latest version of PowerCLI, this was an issue with Version 5.0 of PowerCLI. Thanks

  272. MS

    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?

  273. David

    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

  274. Yohan

    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 🙂

  275. Kenny

    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.

  276. c0de1

    @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 !

  277. Alan Post author

    c0de1, sorry about that, I will take a look and see why it isnt working… Was it something we said 😉

  278. c0de1

    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 ?

  279. Pingback: vCheck for Exchange 2010 - Virtu-Al.NetVirtu-Al.Net

  280. Alan Post author

    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 😉

  281. Yohan Wadia

    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 🙂

  282. kenny

    @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!

  283. Phil

    @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

  284. l8nighter

    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

  285. Sybux

    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 !

  286. Sybux

    @Phil : thx for the tips, but I’ve done it as soon as I’ve point the error 🙂

  287. Phil

    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 🙂

  288. Phil

    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.

  289. Yohan

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

  290. Sybux

    @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 ?

  291. Sybux

    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 ?

  292. Alan Post author

    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 ?

  293. Sybux

    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.

  294. Alan Post author

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

  295. Robert van den Nieuwendijk

    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)

  296. james

    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

  297. james

    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.

  298. Phil

    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

  299. Pingback: Mise à jour vCheck 6.10 | vmdude

  300. Alan Post author

    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.

  301. Fletch

    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

  302. Shane

    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

  303. Alan Post author

    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.

  304. Robert van den Nieuwendijk

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

  305. Shane

    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.

  306. Alan Post author

    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.

  307. james

    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

  308. Phil

    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.

  309. Sybux

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

  310. Robert van den Nieuwendijk

    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

  311. james

    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

  312. james

    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

  313. Alan Post author

    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.

  314. Pingback: vCheck 6.10 update

  315. Pingback: Mise à jour vCheck 6.10

  316. james

    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

  317. RobVM

    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.

  318. Pingback: vCheck updated to 6.10 | | Virtu-Al.NetVirtu-Al.Net

  319. Owen

    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!

  320. Antonio

    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!!

  321. Yohan Wadia

    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… 🙂

  322. Alan Post author

    JT, I am sorry, please do get in contact and I will give you a full refund on this script.

  323. Brian

    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?

  324. Shane

    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?

  325. l8nighter

    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) + “%”}

    }

  326. Howard

    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?

  327. Doug B

    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.

  328. Shane

    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.

  329. Michael Zappa

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

  330. Pingback: Enable the VMware balloon driver vmmemctl to prevent swapping in an imported Linux VM « Yuri's Technology Blog

  331. JT

    I am disappointed in this script!!!!! Can’t get VMkernel errors to report! Previous one was much beter!

  332. ultan

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

  333. Alan Post author

    Thanks for all the comments I have fixed most of these issues in the next version which I will upload soon.

  334. Jon T

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

  335. Jon T

    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

  336. bapt1979

    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

  337. ultan

    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?

  338. Steve Gold

    never mind the last comment after upgrading from PowerCLI 5.0 to 5.1 the scripts completed without error.

  339. Steve Gold

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

    Any thought?

  340. Eelco

    @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 }

  341. rob moore

    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

  342. John Sam

    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.

  343. Phil

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

  344. tom miller

    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

  345. SomeITGuy

    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

  346. Ryan PIghin

    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?

  347. Jeramey

    I want to add the ability to specify which data centers the script will check. Any suggestions would be great…

  348. Phil

    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.

  349. Kev

    Does anyone know why none of the counts and only some of the variables display in the HTML report?

  350. Steve

    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.

  351. Steve

    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.

  352. Alan Post author

    SomeITGUy, Can you do a Get-PowerCLiVersion from PowerCLI, its strange that it isnt picking up the New-VIProperty command in your session.

  353. Alan Post author

    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 !

  354. kenny

    @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…

    🙂

  355. Phil

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

  356. kenny

    @phil, @alan,

    How is the vcheck + the exchange 2010 sample plugin coming along? I definitely want that!

  357. SomeITGuy

    @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

  358. Mark

    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

  359. Phil

    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)

  360. Phil

    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

  361. Phil

    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.

  362. Phil

    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.

  363. Francois

    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.

  364. Alan Post author

    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.

  365. Alan Post author

    SomeITGuy, looks like you have an old version of PowerCLI installed, please install the latest and see how it goes.

  366. Francois

    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.

  367. Sybux

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

  368. Michael

    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!

  369. SomeITGuy

    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

  370. Phil

    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

  371. Sybux

    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 ?

  372. Robert van den Nieuwendijk

    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.

  373. Alan Post author

    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 ?

  374. Alan Post author

    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

  375. Alan Post author

    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 ?

  376. billywestbury

    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

  377. Sybux

    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.

  378. RobVM

    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.

  379. Alan Post author

    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.

  380. RobVM

    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

  381. Alan Post author

    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.

  382. cookies

    New version: Get the error:

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

    Any ideas?

  383. RobVM

    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

  384. Pingback: vCheck 6.0 released

  385. Pingback: vCheck 6.0 est disponible

  386. Kim

    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.

  387. Sai Garimella

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

  388. Alan Post author

    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.

  389. Fred

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

  390. Fred

    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”}

  391. Fred Witteman

    I have 2 ntp servers:
    10.10.10.80
    and
    10.10.10.85
    How should i define the $ntpserver ?

  392. Morrisos

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

    Thanks,
    Morrisos

  393. James B.

    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?

  394. tulk

    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

  395. Ryan PIghin

    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

  396. Luis

    if i wanted to send the report to multiple emial addresses without crating a whole distribution group for it. can i simply do this?

    $EmailTo = “IT@yyyy.com; lpalacio@yyyy.com

    Thank you

  397. Martin

    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.

  398. kenny

    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?

  399. Ulli Hankeln

    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 ?

  400. Yohan

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

  401. Yohan

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

    cant wait for more

  402. bd

    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?

  403. Jinendra

    I have to produce monthly uptime report of all esxi hosts. can we get the same with this script.

  404. fletch00

    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

  405. vShaw

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

  406. ItIsWhatItIs

    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!

  407. Mobashar

    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.

  408. Nick

    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.

  409. lukessi

    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?

  410. Pingback: VMware support documentation and 3rd party tools list « Cavarpe Technology Blog

  411. slaclair

    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

  412. OMGItsVirtual!

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

  413. Chilloutfaktor

    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>

  414. Pingback: Episode 166 – Alan Renouf talks PowerCLI « PowerScripting Podcast

  415. Mike R

    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!

  416. Pingback: VMware vCenter Server Active Directory Web Services LDAP error on instance ADAM_VMwareVCMSDS « Yuri's Technology Blog

  417. J Bell

    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.

  418. Pete L

    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?

  419. IgnitionUSMC

    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)

  420. c0de1

    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.

  421. Todd

    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.

  422. tranquilo

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

  423. tof

    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!

  424. Brian Larsen

    Hi

    In line 1120 rember to change “Version 7” to “Version 8” if you are using vSphere 5.0.

  425. Pingback: Nice vSphere test / report script

  426. Mogens

    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.

  427. bwuch

    @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

  428. ChrisSB

    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

  429. Firestarter

    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

  430. Jithu

    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?

  431. Blade

    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.

  432. cscol

    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.

  433. c0de1

    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 ?

  434. tranquilo

    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

  435. Andy

    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?

  436. Sandeep

    Do you have any SQL script which can tell how many time VM was powered on in last 30/60/120 days?

  437. Kenny

    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.

  438. Pingback: Mellquist.dk » Blog Archive » vCheck – VMware vSphere monitoring and reporting

  439. Kenny

    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?

  440. Corey

    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?

  441. bwuch

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

  442. Roy B

    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…. : /

  443. Jaap

    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

  444. bwuch

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

  445. c0de1

    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 !

  446. Dan D

    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!

  447. Harry Reed

    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

  448. Kenny

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

  449. moehp

    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!

  450. Kenny

    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?

  451. bwuch

    @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

  452. Jorge Cruz

    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

  453. bwuch

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

  454. wayvirtural

    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=`””)
    }

  455. Pingback: Encrypt powershell Credentials (creds) files - Admins Goodies

  456. bwuch

    @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!

  457. c0de1

    Hi, love your work !

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

  458. Pingback: Virtu-Al | Virtually everything is poshable

  459. Matt

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

  460. Pete L

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

  461. Matt

    @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?

  462. Simon

    @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…

  463. Matt

    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?

  464. Pete L

    @Bwuch.
    Thanks that did the trick. I was missing this important piece ($Filename)

  465. bwuch

    @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!

  466. Roger McCarrick

    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

  467. Pete L

    #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?

  468. vColossus

    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.

  469. Corey

    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?

  470. Kenny

    @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***)

  471. Rhys

    @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

  472. Rhys

    @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

  473. bwuch

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

  474. bwuch

    @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
    }
    }

  475. Jon

    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?

  476. Jon

    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?

  477. Thomas M

    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?

  478. Pete L

    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…”

  479. Pete L

    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?

  480. Pingback: vNiklas Virtualization blog » Second day of VMware vSphere PowerCLI Automation Course

  481. James Winner

    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.

  482. Mathieu Bouffard

    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
    }
    }

  483. bwuch

    @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 🙂

  484. Tracy M

    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.

  485. Mark T

    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

  486. Pingback: Audit VMware VM’s for Creator and write to vCenter VM notes with PowerShell and PowerCLI 4.1.1 | Learn Powershell | Achieve More

  487. Pete L

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

  488. bwuch

    @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 🙂

  489. Pete L

    @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? 🙂

  490. bwuch

    @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

  491. bwuch

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

  492. Pingback: EnterpriseAdmins.org » Blog Archive » vSphere Snapshot Report

  493. Pete L

    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.

  494. Pete L

    @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?

  495. molski

    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

  496. Pete L

    @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

  497. bwuch

    @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?

  498. Pete L

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

  499. Pete L

    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

  500. Pete L

    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.

  501. Tracy M

    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?

  502. Pete L

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

  503. bwuch

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

  504. Pete L

    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.

  505. Pete L

    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)

  506. bwuch

    @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”

  507. Kenny

    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.

  508. Pete L

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

  509. Pete L

    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”

  510. Simon

    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…

  511. Pete L

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

  512. Robert van den Nieuwendijk

    The check for ESXi Lockdown Mode doesn’t work correctly. I changed the line:
    $ESXiUnlocked = @($ESXiLockDown | Where { $_.LockedMode -eq “False” })
    into:
    $ESXiUnlocked = @($ESXiLockDown | Where { -not $_.LockedMode })
    to make it work. The problem is that $_.LockedMode is a boolean and not a string.

  513. Matt

    Bah. Answered my own question. Running it from the vcenter server didn’t work. Running it from my local desktop worked fine. Weird, no?

  514. Matt

    Hmm, my report is only showing 1 host, 1 vm, 1 datastore, etc. when I have bunches of each). The script authenticates fine (as I can use the connect-viserver command fine alone). I’m pretty new at PowerCLI (let alone PowerShell). Any hints as to what to look for? Is there a debug mode?

  515. Pingback: PowerShell Scripts And The ExecutionPolicy Issue | DeinosCloud

  516. Pingback: vCheckv5 Script And The ExecutionPolicy Issue | DeinosCloud

  517. Sandy Bryce

    Awesome Script, got it running a part of our operations team daily checks.
    thanks.

  518. Ryan P

    I am new to PowerCLI and I love it. This report is very helpful. I am having a small issue when I run it. When the report is completed, it is showing duplicates of everything. (Number of host showing 14 and we only have 7, VMs showing 128 and we only have 64, Snapshots are showing twice) Any ideas why that would be showing up this way?

  519. Med

    Hi,

    the script run fine but it take only 5 minutes to finish…

    but there’s no dispay in IE, no file in C:\tmp

    could someone tell me why ?

  520. cookies

    Not getting any emails, even after chainging the code to send as attatchment as per above comments.

    This is run on the vcenter server 4.1.0 box

    Still runs fine on my old virtual center 2.5 box (with the script execution pointed at the new vc)

  521. Sean

    Has anyone else had any problems getting it to report VM Disk space available?

    # VM Disk space left, set the amount you would like to report on
    $MBFree = 10000

  522. bwuch

    Changed Block Tracking (CBT) is the ability of a virtual machine to keep track of disk sectors that have changed. The CBT feature can be accessed by third-party applications as part of the vStorage APIs for Data Protection. Applications can use the API to query the VMkernel to return the blocks of data that have changed on a virtual disk since the last backup operation. Detail is available here: http://kb.vmware.com/kb/1020128.

    If you have a backup solution that leverages CBT, you’ll want to make sure these bits are enabled. The code is very good in that it not only checks for CBT, but allows you to configure if the default CBT value should be enabled or disabled. For example, if your backup solution does not use the vStorage APIs for Data Protection you probably do not want the overhead of tracking which blocks change.

  523. Bill

    By the way, I found vcheck from the book I received this week:

    VMware vSphere
    PowerCLI Reference
    c2011

    Pages 430, 656-657

  524. Bill

    I’m using a read-only account for safety, one of the VCs I access also gives me the typo’d error message:

    5:00:00 PM ..Checking Snapshots
    WARNING: Unable to populate snapshot size due to unsiffucient permissions.

    ‘unsiffucient’?

    Doesn’t appear to come from the script.

  525. rhys

    Hi

    Ok, I have updated my CBT code to actually work, its not the most elegant but does work

    # Show CBT Variations
    $ShowCBT = $true
    $CBTdefault = “true”

    # —- Show CBT —– #
    if ($ShowCBT) {
    Write-CustomOut “..Checking for CBT status”
    $cbt = @()
    foreach ($vmguest in ($VM | get-view))
    {
    $name = $vmguest.name
    $vmguest.Config.ChangeTrackingEnabled | %{
    if ($CBTdefault -eq ‘true’){
    if (!$vmguest.Config.ChangeTrackingEnabled -eq ‘true’){
    $myObj = “” |
    select Name,ChangeBlockTrackingStatus
    $myObj.Name = $name
    $myObj.ChangeBlockTrackingStatus = $vmguest.Config.ChangeTrackingEnabled
    $cbt += $myObj
    }
    }
    else {
    if ($vmguest.Config.ChangeTrackingEnabled -eq ‘true’){
    $myObj = “” |
    select Name,ChangeBlockTrackingStatus
    $myObj.Name = $name
    $myObj.ChangeBlockTrackingStatus = $vmguest.Config.ChangeTrackingEnabled
    $cbt += $myObj
    }
    }
    }
    }

    If (($cbt | Measure-Object).count -gt 0 -or $ShowAllHeaders) {
    if ($CBTdefault -eq ‘true’){
    $myReport += Get-CustomHeader “Change Block Tracking Disabled Count : $($cbt.count)”
    }
    else{
    $myReport += Get-CustomHeader “Change Block Tracking Enabled Count : $($cbt.count)”
    }
    $myReport += Get-HTMLTable $cbt
    $MyReport += Get-CustomHeaderClose
    }
    }

    Thanks

  526. vShaw

    @Travveler: You can attach the report but not display it – Use the modifications from @shartma and enable $DisplayToScreen — just comment out the Invoke-item so the report is never actually displayed during runtime:

    if ($DisplayToScreen) {
    Write-CustomOut “..Displaying HTML results”
    if (-not (test-path c:\tmp\)){
    MD c:\tmp | Out-Null
    }
    $Filename = “C:\tmp\” + $VIServer + “vCheck” + “_” + $Date.Day + “-” + $Date.Month + “-” + $Date.Year + “.htm”
    $MyReport | out-file -encoding ASCII -filepath $Filename
    #Invoke-Item $Filename

  527. Rhys

    Hi

    Here is some code to find which machines have change block tracking disabled. there is a problem with the logic. Ill sit down at some point and look again. But current code is below, let me know if it can be improved upon

    # Check for Disabled Change Block tracking (not complete, some logic is wrong, and will only report on FALSE at present (ESX4 or above required))
    $ShowCBT = $true
    $CBTdefault = “True”

    # —- Show CBT —– #
    if ($ShowCBT) {
    Write-CustomOut “..Checking for CBT status”
    $cbt = @()
    foreach ($vmguest in ($VM | get-view))
    {
    $name = $vmguest.name
    $vmguest.Config.ChangeTrackingEnabled | %{
    if (!$vmguest.Config.ChangeTrackingEnabled -eq $CBTdefault){
    $myObj = “” |
    select Name,ChangeBlockTrackingStatus
    $myObj.Name = $name
    $myObj.ChangeBlockTrackingStatus = $vmguest.Config.ChangeTrackingEnabled
    $cbt += $myObj
    }
    }
    }
    If (($cbt | Measure-Object).count -gt 0 -or $ShowAllHeaders) {
    if ($CBTdefault -eq ‘true’){
    $myReport += Get-CustomHeader “Change Block Tracking Disabled Count : $($cbt.count)”
    }
    else {
    $myReport += Get-CustomHeader “Change Block Tracking Enabled Count : $($cbt.count)”
    }
    $myReport += Get-HTMLTable $cbt
    $MyReport += Get-CustomHeaderClose
    }
    }

    Hope this proves usefull to someone

    Thanks

  528. fletch

    Hi – great script!
    Q: v5 reports ballooning for a few VMs – but I go into VI client performance->memory and the ballooning shown there (this is ESXi 4.1U1) is Zero for realtime, day, week.

    Can you explain the script reporting ballooning, but VI client reports zero ballooning of memory?

    thanks!

  529. Alok

    How long does it run for? I ran the script and it is stuck at checking “capacity info” for more than 16 hours. It would be nice if there is some kind of logging to find whats going on… Is it normal to be collecting capacity info for 16 hours? I have around 20 ESX and a handful of datastores.

  530. bwuch

    @Mark, I believe the warnings you see relate to changes in PowerCLI 4.1U1. The script will still run with the warning in place and the results of the check are still accurate. However, if you don’t want to see these warnings, you can check out the modifications I’ve made to Al’s awesome vCheck script. The latest changes I’ve made are available here:

    http://enterpriseadmins.org/blog/scripting/vcheck-daily-report-version-5-31/

    I’ve added a handful of feature requests — found from right here in the comments — plus a few other things I wanted along the way.

    I hope this works for you!

  531. Mark

    I’ve just implemented the script on a W2K8 R2 server with vSphere 4.1. When I manually kick off the script I see a couple errors in the PowerShell window.

    First error is after Host & Maintenance Mode:
    Warning ‘State’ property is obsolete, use ‘ConnectionState’ instead.

    Second error is after VMs Swapping & Ballooning:
    Warning ‘Host’ property is obsolete, use ‘VMHost’ instead.

    Tried swappping the recommendation out in a couple of places for the first warning and saving the script, then running but still got the warning… Any ideas?

    Thanks

  532. Manuel

    What is the format for the credentials file. What to automate the running of this script.

  533. Chuck

    I have 2 VC’s and this script takes for every to run. I have 58 Hosts and 783 Guests in one VC and 43 Hosts and 388 Guests in the other VC. Can I automate this script to run overnight? How?

  534. Michael

    also having the “multiple prompts for credentials” issue when running this script on a windows 2008 R2 (where vCenter is installed) desktop session with AD account nested in local admin group.

    no difference if i run it from power VMware CLI window, called out from a command prompt, or from scheduled task.

  535. Pingback: EnterpriseAdmins.org » Blog Archive » vCheck (daily report) version 5.31

  536. Pingback: VMware vCenter ADAM_VMwareVCMSDS Warning : My Geek Finds

  537. Simon

    Where has that guy gone with the spreadsheet of all the proposed updates ? Or has Al included them himself already ?

  538. Karl

    I keep getting a log in request at these points:
    ..Checking VC Services
    ..Checking VC Error Event Logs
    ..Checking VC Warning Event Logs

    I don’t know which password it wants. Does anyone know how to get this to go away? The information I get from the script is very useful, but I can’t schedule it to go on its own when it stops for these pop-ups.

    Thanks

  539. James1001

    Hi, First of all, thanks for this script, it’s amazing ! I have no scripting knolwedge and I’ve even managed to implement it successfully. Could I add something for a wish list, or if someone has already added this could you let me know the code… I would also like to have a section which reports on disk alignment. I have seen a number of individual scripts, but I’d like to be able to incorporate, it into this excellent script…many thanks for any help you can give me….

  540. Keith

    Excellent script 😉 I have the same problem getting the output as an attachment as Samir described…..

    I have Changed function Send-SMTP to below:
    function Send-SMTPmail($to, $from, $subject, $smtpserver, $body, $Filename) {
    $mailer = new-object Net.Mail.SMTPclient($smtpserver)
    $msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
    $att = new-object Net.Mail.Attachment($Filename)
    $msg.Attachments.Add($att)
    $msg.IsBodyHTML = $true
    $mailer.send($msg)
    }
    Added $Filename to the function Send-SMTPmail line and added:
    $att = new-object Net.Mail.Attachment($Filename)
    $msg.Attachments.Add($att)

    But still the report is not coming as attachment.
    What else do I need to do?

  541. Gonzalo

    How to know? Many times. I think it never uses the credentials stored in the encrypted file. It asks int the begining, and three or four times during the execution of the script. If I insert the same credentials (the one used in the bigining) works fine.

  542. Gonzalo

    I’m having problems with the credentials. Can’t schedule this script because it asks for username and password many times. Any solution???

  543. Christian

    Hi there,
    it´s a great script. But i have a “Feature” Request.
    It is possible to change the snapshot check so that i get only the size of the snapshot files? Not the whole used space?
    I found a script that do this, but i am not familiar with PowerCli to implement it.
    Bye Christian

  544. bwuch

    @Samir – I haven’t tested this, but I believe you could change this line:

    $Filename = “C:\tmp\” + $VIServer + “vCheck” + “_” + $Date.Day + “-” + $Date.Month + “-” + $Date.Year + “.htm”
    -to-
    $Filename = “C:\tmp\” + $VIServer + “vCheck” + “_” + $Date.Day + “-” + $Date.Month + “-” + $Date.Year + “_” + $Date.Hour + “-” + $Date.Minute + “.htm”

    To add the hour and minute to the output file. You’ll note I used a dash between hour & minute — if I remember correctly, a colon is not a valid character to use in a file name.

  545. Samir

    Just a quick question. I am running the script twice a day. but due to the same name of the report generated e.g. VCproductionvCheck_14-1-2011.htm. The previous report gets over written. is it possible to have the output reports name contain timing e.g vmcpesuwp01lcvCheck_14-1-2011_12:08.htm

  546. bolsen

    Since other people are submitting requests, I’ll add mine. Most of them are storage centric but I think everyone would benefit from it.

    – Top 10 VM consumers of host disk IP (over x number of days).
    – Top 10 datastores with highest latency (over x number of days).
    – Top 10 datastores with lowest latency and most free space (helps decide where to put the next VM).
    – VMs with disk latency higher than x (over x number of days).

    The more focus we can put on storage the better performance gets! If you need 48 hours, let me know and I’ll do what I can.

  547. Simon

    With all these good enhancements going on its probably worth mentioning two issues I’ve seen;

    1) With the “The following VMs are located on storage which is only accesible by 1 host,” check, local disks are listed. Should these not be excluded ?

    2) The capcity data seems misleading. One cluster shows on the report under CPU that it can have 1500 additional machines based on HA requirements, and yet I know that cluster is reaching significant CPU contention caused mainly by the number of VM’s with 4 vCPU’s.

    Also all clusters are reporting as having capacity for hundreds of additional VM’s based on memory, and then all the hosts are listed as having over commited memory. I realise one is based on allocated and the other on used, but the data will surely give people an unrealistic picture of their actual capacity situation ?

    I’m being picky of course – its a great report and VMWare would do well to include all this info in the VI client….!

  548. Samir

    Hello Guys,

    I have Changed function Send-SMTP to below:

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

    Added $Filename to the function Send-SMTPmail line and added:

    $att = new-object Net.Mail.Attachment($Filename)
    $msg.Attachments.Add($att)

    But still the reports is not coming as attachment.

    Any idea ?

  549. ldornak

    I noticed that the VM disk space check would only report on
    the 1st disk in the VM. I also would like to report on % free in
    addition to MB free. For example, report on all VM disks that have
    less than 5% free AND 500MB free. I added the following code to
    accomplish the task…. Add this to the details settings section of
    the user configurable variables: # VM Disk space left, under x
    percent free and under x MB free $diskPercFree = 5 $diskMBFree =
    500 Add this to the 2nd user configurable area: # Show VMs disk
    space check $ShowGuestDiskFree = $true Add this to the body of the
    script. (I added it below the existing section “—- VM Disk Space
    – Less than x MB —-” # —- VM Disk Space – Less than x percent
    —- If ($ShowGuestDiskFree){ Write-CustomOut “..Checking for
    Guests with less than $diskPercFree percent” $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){ $myCol = @()
    Foreach ($disk in $VMdsk.Guest.Disk){ $CapacityMB =
    ([math]::Round($disk.Capacity / 1MB)) $FreeSpaceMB =
    ([math]::Round($disk.FreeSpace / 1MB)) $_ = “” | Select-Object
    Name, Path, CapacityMB, FreeSpaceMB, PercFreeSpace $_.Name =
    $VMdsk.Name $_.Path = $disk.DiskPath $_.CapacityMB = $CapacityMB
    $_.FreeSpaceMB = $FreeSpaceMB $_.PercFreeSpace =
    ([math]::Round(((100 * ($FreeSpaceMB)) / ($CapacityMB)),0)) $myCol
    += $_ } $MyCollection += $myCol } $VMPercFreeWarn = @($MyCollection
    | Where {$_.PercFreeSpace -lt $diskPercFree -and $_.FreeSpaceMB -lt
    $diskMBFree} | Sort Name) If (($VMPercFreeWarn |
    Measure-Object).count -gt 0) { $MyReport += Get-CustomHeader “VMs
    with less than $diskPercFree % free AND $diskMBFree MB free :
    $($VMPercFreeWarn.count)” “The following guests have less than
    $diskPercFree % Free AND $diskMBFree MB Free, if a guest disk fills
    up it may cause issues with the guest Operating System” $MyReport
    += Get-HTMLTable $VMPercFreeWarn $MyReport += Get-CustomHeaderClose
    } }

  550. Russ

    Al,

    Have you ever thought about open sourcing it, etc? There are licenses that would allow you to keep things from forking, but would allow a larger portion of the community to participate and continue to improve on this already great script.

    At a minimum move to a community based approach with hosting on a source forge, github, code plex type repository.

    I think you would see some great additions from the community.

  551. Gernot Nusshall

    hi, v3 worked perfect in my environment but v5 hangs on
    that point: 13:30:06 Connecting to VI Server 13:30:06 Collecting VM
    Objects 13:30:08 Collecting VM Host Objects 13:30:10 Collecting
    Cluster Objects 13:30:10 Collecting Datastore Objects 13:30:10
    Collecting Detailed VM Objects 13:30:13 Collecting Template Objects
    13:30:13 Collecting Detailed VI Objects 13:30:14 Collecting
    Detailed Alarm Objects 13:30:14 Collecting Detailed VMHost Objects
    13:30:19 ..Adding General Summary Info to the report 13:30:26
    ..Checking Capacity Info any ideas? thanks

  552. Virtu-Al

    That’s great, cant wait to try out your changes and add them to v6, please do send over the spreadsheet and I will add it to the list I have in mind. I love the way people can pick this up and adjust it, that’s one of the things I wanted to be easy when creating the script!

  553. bwuch

    Al – Just wanted to say that you’ve got a great script here. If it were possible I would be glad to give you a couple of hours of my day so you could work on this 🙂

    I’ve spent a couple of hours recently trying to add some features and document other requests. I have a spreadsheet listing some of the requested features (from all the comments on this post) and an updated script with a dozen or so of those features added. I would be glad to share them with you if you are interested.

    Thanks again!

  554. Pingback: EnterpriseAdmins.org » Blog Archive » vCheck (Daily Report)

  555. Michael

    it appears that html is not supported, the link to the
    image is ‘http://img840.imageshack.us/img840/1930/lockedz.jpg’
    also, thanks for the tip for multiple NTP servers, worked great for
    my environment.

  556. Michael

    I noticed for some time now that the script (at least in my
    ESXi 4.1 and power CLI 4.1.1 environment) that the lockdown mode
    portion shows false positives even though lockdown mode is enabled.
    the result even shows all the hosts as LockedMode is “true”.
    searched though the comments to see if anyone is experiencing this,
    see image for example (i hope html is supported). Uploaded with ImageShack.us any ideas?
    thanks.

  557. bolsen

    Ha! Good timing – I just happened to be looking for another script when I decided to add my comment. I didn’t see Al’s message two above mine!

  558. Simon

    Well we all appreciate your efforts even if the wife doesn’t!

    If you do add that script it would be worth adding an exclusion for local disks…(in my opinion)

    Just as an FYI – I get this warning “WARNING: ‘State’ property is obsolete. Use ‘ConnectionState’ instead.”

  559. Virtu-Al

    I agree, that would be a great addition, maybe one day I will get time to update this script with this and the other ideas I have! Perhaps I should make a chargeable version of the script – at least that way it would make it justifiable to the wife when I work weekends ;). Great idea though!

  560. Robert van den Nieuwendijk

    My previous solution was an advantage but is not perfect. I still see messages with a future date in januari 2011. So I changed the line starting with if into:
    if ($Details.Time.Month -gt $Today.Month -or ($Details.Time.Month -eq $Today.Month -and $Details.Time.Day -gt $Today.Day)) {$Details.Time = $Details.Time.AddYears(-1)}

    The only problem still left is that it is possible that you will see error messages from a previous year. I think it is not possible to solve this problem untill the Get-Log cmdlet returns a date with the year included.

  561. Robert van den Nieuwendijk

    Since the first of januari the vCheck report shows events in the future in the “ESX/ESXi VMKernel Warnings” section. Of course I like a script that reports about future events ;-). But I think in this case it is a bug. The PowerCLI Get-Log cmdlet returns messages with a date without the year. E.g. “Dec 12 06:07:32”.

    The line in the code:
    “{$Details.Time = ([datetime]::ParseExact(($_.split()[0] + ” ” + $_.split()[1] + ” ” + $_.split()[2]), “MMM dd HH:mm:ss”, $SysGlobalization))}”
    converts this date into “12-12-2011 6:07:32”. Which has the wrong year.

    You can solve this problem by adding the following lines of code at the appropriate places to the vCheck script:
    $Today = Get-Date
    if ($Details.Time.Month -gt $Today.Month) {$Details.Time=$Details.Time.AddYears(-1)}

  562. Chris J

    Excellent Script!!!

    I have multiple NTP servers set on some ESXi servers and the report says the NTP settings are not correct. I have added both of the IP addresses for the NTP servers in, $ntpserver = “10.1.10.130,10.1.10.131”, but it still says the settings are not correct. I have tried with no comma between IPs and with just a space between IPs. Ideas?

    Our email server requires authentication to send an email out, is there a way to put a user name and password for the SMTP server in?

  563. Matt F

    Thank you for producing such a great checking/reporting
    script and making it freely available! When I execute the script
    (using VMware-PowerCLI-4.1.1-332441), I receive the following
    warnings, but the problem I have is the script seems to
    hault/freeze on the “.. Checking Snapshots” section. I was only
    able to successfully run the script to completion after commenting
    out the ‘Snapshot’ section: > .\vCheck5.ps1 {VI_SERVER}
    Connecting to VI Server WARNING: Index was outside the bounds of
    the array. ..Checking for Map disk region event ..Checking Hosts in
    Maintenance Mode WARNING: ‘State’ property is obsolete. Use
    ‘ConnectionState’ instead. ..Checking Hosts Not responding or
    Disconnected ..Checking for VMs swapping or Ballooning WARNING:
    ‘Host’ property is obsolete. Use ‘VMHost’ instead. I’d very much
    like to have the Snapshot information included, are you aware of an
    issue with the Snapshot function working in this version of
    PowerCLI? I’d very much like to include this information, is there
    a fix or work-around that can be applied? Thank you in
    advance.

  564. Patrick

    Great script!

    I hope you don’t mind but I added a few lines of code to attach the rendered HTML file as an attachment to the e-mail. Outlook 2007 doesn’t support some of the CSS that’s specified in the script.

    Changed function Send-SMTP to below:


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

    Added $Filename to the function Send-SMTPmail line and added:

    $att = new-object Net.Mail.Attachment($Filename)
    $msg.Attachments.Add($att)

    in the middle.

    Then I added “$Filename” to line 1574.

    There’s most likely a better way to do this, but works for me.

  565. richbaynes

    @ Robert

    No problem 🙂 I got the script running, many thanks.

    I have another question… I am running this script against two separate VC’s. I have 2 separate scheduled tasks configured, pointing at the same script in the same location. When the script runs inititally it creates the mycred.crd file. I assume this will cause an issue if I run the script against 2 VC’s as it can’t create mycred.crd twice in the same location? I also presumed that, if using the same user account to run against the second VC (I have the same account configured with the same permissions on both VC’s), that it would work, unless the encryption algorithm generates some other value, possibly based on the server it is connecting to.

    So I created 2 separate copies of vCheck in separate locations. I then ran the script. It seemed to work normally to start with, asking for the authentication initially which I entered. However, after warning about the SSL certs, it then prompted for authentication again. I entered the creds and the script carried on executing normally with no further interaction. After the script had finished, I ran it again, but once more was prompted for creds twice before it would execute.

    So I am wondering where the issue lies? I have modified the script so the absolute path to the mycred.crd file is given in both cases, but this makes no difference. Does PoSh cache the mycred.crd value somewhere? I am able to run the script if I pass the VC UID and password in the script, so I am happy the account has the correct permissions. Has anyone seen this before?

  566. Robert van den Nieuwendijk

    @Rich B

    The hyphen in front of the vCenter Server name was a typo. So you should remove the hyphen ;-).

  567. Rich B

    @Robert

    Sorry Robert, one last query. Where you pass the vc host name you have prefixed with ” – “. Is that required? My VC has a hyphen as part of the host name – will that cause an issue?

  568. Rich B

    @Robert

    Thank you again.

    Firstly, do I need to pass the -psconsolefile option as I have specified it in the script? Secondly, where in the string you detailed does it pass the vCenter host name?

    regards

  569. Robert van den Nieuwendijk

    I see that in my previous post the command line was missing a piece. Probably by inapropriate handling of accolades by the web site software. I will try again. Replace ampersand, accolade-open and accolade-close with the appropriate signs:

    %SystemRoot%\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “ampersand accolade-open c:\vCheck.ps1 -vCenterServerName accolade-close” > vCheck–vCenterServerName.log 2> vCheck-vCenterServerName-error.log

  570. Robert van den Nieuwendijk

    @Rich B

    I wil show you how I run the vCheck script. First, I run the scheduled task with a service account that has sufficient right at the vCenter server. Second, the scheduled task runs a .cmd file with the following line of code:

    %SystemRoot%\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “” > vCheck-vCenterServerName.log 2> vCheck-vCenterServerName-error.log

    Replace vCenterServerName with the name of your vCenter server.

    All the normal messages of the script will go to the vCheck-vCenterServerName.log file. The error messages will go to the vCheck-vCenterServerName-error.log file.

  571. Robert van den Nieuwendijk

    For everybody complaining about the speed of the vCheck script try installing the latest PowerCLI version 4.1U1. It made running the vCheck script in my environment much faster.

  572. Rich B

    @Robert

    Robert I ran the command and set proxy as disable all. I ran the scheduled task but it failed again with the same error. It works ok when run from the shell, so still think the issue is with the task scheduler – just not certain whether the issue is that it hasn’t passed the VI server info or the credentials.

    Is there any way of forcing std error output to a log file from the posh script?

    regards

  573. Rich B

    I was also wondering… is there a way to force task scheduler to show the posh window as the task executes?

  574. Rich B

    Thanks Robert.

    Does PowerCLI try to use the proxy (if configured) even if the exclusion list includes addresses on the same network?

    testing now…

  575. Robert van den Nieuwendijk

    I made an extension to the vCheck script to check for ESX servers that are not compliant with the VMware Update Manager attached baselines. Don’t forget to install the VMware vCenter Update Manager PowerCLI before you try my code. Enjoy!

    # Hosts not compliant to VMware Update Manager Baselines
    $ShowHostVUMNonCompliance = $true

    # —- Hosts VMware Update Manager Baseline non-compliance —-
    If ($ShowHostVUMNonCompliance){
    Write-CustomOut “..Checking Hosts VMware Update Manager Baseline non-compliance”
    Add-PSSnapin -Name VMware.VumAutomation
    $NonCompliance = Get-VMHost | Sort-Object -Property Name | Get-Compliance | Where-Object {$_.Status -ne “Compliant”}
    If (($NonCompliance | Measure-Object).count -gt 0) {
    $MyReport += Get-CustomHeader “Hosts VMware Update Manager Baseline non-compliance : $($NonCompliance.count)” “The following hosts are not compliant to the attached baselines”
    $MyReport += Get-HTMLTable ($NonCompliance | Select-Object -Property @{N=”Host”;E={$_.Entity}},@{N=”Baseline”;E={$_.Baseline.Name}},Status)
    $MyReport += Get-CustomHeaderClose
    }
    }

  576. Robert van den Nieuwendijk

    The “The Connect-VISERVER Cmdlet did not work, please check you VI Server.” error message is probably due to your proxy settings.

    Use the following cmd to set your powercli to bypass the proxy and try connecting again:

    Set-PowerCLIConfiguration -Proxy “NoProxy”

  577. Rich B

    has anyne got this running on Win 2k8 x64 as a scheduled task? I can get the task to run, but it fails after 5 minutes and forwards an email with the error:-

    The Connect-VISERVER Cmdlet did not work, please check you VI Server.

    I am passing the command directly into the scheduler as follows:-

    Program/Script = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Add Arguments (Optional) = -noexit “& ‘d:\ecoshell_scripts\vcheck\vcheck5.ps1′” my-vcenter

    I am using a cred file to pass the authentication, so I am not sure if the error is caused because the VC info has not been passed, or the UID and password.

    I have modified the following section of the script to try to make it use the cred file:-

    If ($SetUsername -ne “”){
    if ((Test-Path -Path $CredFile) -eq $false) {
    Set-Cred $CredFile
    }
    $creds = Get-Cred $SetUsername $CredFile
    }

    Write-CustomOut “Connecting to VI Server”
    $VIServer = Connect-VIServer $VISRV -Credential $creds
    If ($VIServer.IsConnected -ne $true){
    # Fix for scheduled tasks not running.
    $USER = $env:username
    $APPPATH = “C:\Documents and Settings\” + $USER + “\Application Data”

    #SET THE APPDATA ENVIRONMENT WHEN NEEDED
    if ($env:appdata -eq $null -or $env:appdata -eq 0)
    {
    $env:appdata = $APPPATH
    }
    $VIServer = Connect-VIServer $VISRV -Credential $creds
    If ($VIServer.IsConnected -ne $true){
    Write $VIServer
    send-SMTPmail -to $EmailTo -from $EmailFrom -subject “ERROR: $VISRV vCheck” -smtpserver $SMTPSRV -body “The Connect-VISERVER Cmdlet did not work, please check you VI Server.”
    exit
    }

    I’m not sure what impact the ‘# Fix for Scheduled Tasks Not Running’ has. It seems to be mapped for a Windows 2k3 environment rather than 2k8, but that is probably irrelevant. Maybe my syntax is wrong or incomplete. Anyone have any ideas, or been able to get this to work with task scheduler?

  578. Neil Newman

    Samir, That’s normal, the reason for that is that the “default” install of your vcentre uses an certificate that does not match your hostname, the script should still work, did it produce an email ok ?

    If you really want to get rid of the message you will need to install a certificate, see http://kb.vmware.com/kb/1021514 for details on how to.

    Regards

    Neil

  579. Samir

    Hello Neil,

    Thanks for the reply.

    Now i am getting the below message. Any idea why ?

    “There were one or more problems with the server certificate:
    * A certification chain processed correctly, but terminated i
    der.
    * A required certificate is not within its validity period.

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

  580. Neil Newman

    Hi Samir, try the following

    edit your vcheck5.ps1 script, add the following line as line 2 in the script.

    add-pssnapin VMware.VimAutomation.Core

    save script and then try running .\vcheck5.ps1 vmcpaup01lc

    if that still doesn’t work, check you have all the prereqs installed.

    ◦PowerShell V2 Download from http://support.microsoft.com/kb/968929
    ◦PowerCLU 4.0 U1 or later version Download from http://www.vmware.com/support/developer/PowerCLI/index.html

    Regards

    Neil

  581. Samir

    Hello Rich,

    I have changed the script to

    Write-Host “Please specify a VI Server name eg….”
    Write-Host “powershell.exe vCheck.ps1 MyvCenter”

    Then I ran this command on powershell.
    .\vCheck5.ps1 vmcpaup01lc

    I received an email saying that
    The Connect-VISERVER Cmdlet did not work, please check you VI Server.

    I think i am really bad in scripting 🙁

  582. Rich B

    Sorry, my bad.

    Syntax on the command is .\vcheck.ps1 myvcenter

    I never could get my slash orientation correct 🙁

  583. Rich B

    No problems Samir.

    Firstly, you do not need to modify the script on the lines you mentioned. The ‘write-host’ command just outputs info to the shell, such as error messages. If you have received the message it is because the script does not know which vCenter to connect to.

    Secondly, from the PowerCLI shell, CD to the directory where your script is located and use the command:-

    ./vcheck.ps1 myvcenter

    Where myvcenter is the host name of your vCenter server, and assuming the script is called vcheck.ps1. This will launch the script and you should see response output in the shell as it executes.

    Hope that makes sense 🙂

  584. Samir

    Hi Rich,

    Please spare me for not understand the script and how will i get the output.

    i m using Windows Power Shell 1.0. I have entered the vCenter Server as below. Do i need to enter the VC server name somewhere else.

    Write-Host “Please specify a VI Server name eg….”
    Write-Host “powershell.exe vCheck.ps1 vmcpaup01lc”

    Note: I am running this script on VC server itself.

  585. Rich B

    @ Samir

    Are you running it from the PowerCLI shell Samir? Did you specify a vCenter Server in the string?

  586. Samir

    when i run the script it gives only the below message.

    “Please specify a VI Server name eg….
    powershell.exe vCheck.ps1 vmcpesuwp01lc”

    But it doesnt deliver email to my mailbox.

    Please can anyone of you let me what i am doing wrong. I am running the sciprts on VC itself. my VC configuration is 2.5 U2 and windows powershell.

    I have enter SMTP address in my VC mgmt server configuration.

    Thanks

  587. Rich B

    Has anyone got this owrking on Windows 2k8 as a scheduled task? I can get the script to execute with the scheduler, but it fails to connect to the VC. I receive the email advising of the failure to connect-VIserver, so I’m happy SMTP is working at least!

    The bit of the script I have looked at is line 702 – 716. I noticed the ‘fix for scheduled tasks’ and the $apppath syntax is for W2K3. Does this need to be modified for W2K8, or does the symbolic link that 2K8 keeps for backwards compatibilty take care of it?

    The script runs normally when executed from a batch file, but the scheduler doesn’t seem to pass the connection string properly.

  588. Darren K

    Hi I can run the script locally on the vCenter server and manually but I do receive the following warnings in the display:

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

    * A certification chain processed correctly, but terminated in a root certificate which isn’t trusted by the trust provider.

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

    I also get:

    Warning: Unable to populate snapshot size due to insufficient permission.

    The account I am using has local admin privileges and also has the administrators role in vCenter itself.

    Also when I send the email I get the email but with an error pertaining to Adjusting Connection Information section I have manually specified the credentials as suggested with the same account (local administrator and administrators role in vCenter) but I still get the problem.

    Obviously I appreciate it suggests a credentials problem. But can someone clarify what credentials are needed as I thought that would suffice.

    Would very much appreciate some advice on this as it would be extremely useful to us if I can get this working.

    Thanks Darren

  589. Robert van den Nieuwendijk

    Hi Rich,

    You have to change the first and second lines of your code. The param line should always be the first line. The Add-PSSnapIn line should be after the param line.

    Regards, Robert

  590. Rich B

    I am struggling to get the code to run. Debugging points to the first line (actually second line) in my code:-

    param ( [string] $VISRV)

    I have added add-pssnapin VMware.VimAutomation.Core as line 1 in my script.

    Error is :-

    The term ‘param’ 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 :line:2 char:5
    + param <<<< ( [string] $VISRV)

    Using PS v2, PowerCLI 4 u1, on Win2k8 x64.

  591. David M.

    Hi Al
    Your Website is absolutely awesome ! I often use your scripts at work or just for new ideas to create my own scripts. Your vCheck is very great, even though I have some running time issues with it. We’ve got a pretty huge environment and so the CapacityInfo part takes almost for ages to complete. So I played around with it a little and figured something out. If I simply add -IntervalSecs 7200 to the cpu.usagemhz.average and mem.consumed.average the hole part is running much faster. If I change the value to 1800 secs it gets even faster. I used measure-command and the time it takes to get the cpu values for only one host is only a third of the time it took before. Maybe this only works for me… but hopefully it helps other people too 🙂

  592. Mattias Geniar

    The solution to Outlook is actually fairly simple, without going through the “Attachment hack” (+ I prefer my content directly in the e-mail, not in an attachment, makes it easier on mobile devices).

    If you just stick all the CSS options into variables, and don’t use classes but only inline-styles, Outlook will parse it without a problem.

    So make a variable “$css_dspheader1” with the exact content of the “dsp” and “dsphead0”, and change the ‘class=”dsp dsphead0″‘ with ‘style=”$($css_variable)”‘, so all the CSS markup is done inline, and not in those CSS styles defined at the top.

    While it’s not really pretty, it doesn’t change much from the programming point-of-view, as you’ll only declare your CSS styles once, but they’ll be present multiple times in the mail.

  593. Neal

    We have multiple vcenter servers in my environment. Could the script be modified to pull data from more than one vcenter server, or would I have to run it individually against each?

  594. Pingback: vCheck (Daily Report) script « VMtech.se

  595. tien lam nguyen

    I can’t seem to make the script run as a scheduled task with windows 2008 scheduler.
    the task will run but will not seem to stop. The status is alwyys on running mode even after 24 hours.

    I have changed my line from:
    $VIServer = Connect-VIServer $VISRV
    to
    $VIServer = Connect-VIServer $VISRV -cred $creds
    and the settings for my scheduler are as follows.
    Under program/scripts: powershell.exe
    Under Add arguments (optional) -noninteractive -noprofile -command “”
    Under Start in (optional): C:\Scripts\vCheck

    Interesting enough if I run the command from the prompt like this:
    J:\>powershell.exe -noninteractive -noprofile -command “”
    It would run fine.

    SO what it is that I am not doing correctly in windows 2008 scheduler ?

  596. Pingback: ESX3.5/vCenter2.5 Slot Size Calculation For vCheck v5 « DeinosCloud

  597. Leo

    It looks like the function that should check free space on VMs actually checks just a hard drive capacity.
    I’ve changed this part of code:
    from
    if (([math]::Round($disk.Capacity/ 1MB)) -lt $MBFree){
    to
    if (([math]::Round($disk.FreeSpace/ 1MB)) -lt $MBFree){

    Now it makes more sense.

  598. Richard Gard

    The following is code I wrote for just checking the free space of the C:\ drive. Enjoy.

    Top Section
    # Show VMs C:\ disk space check
    $ShowGuestCDriveSpace = $true

    Code Section:
    # —- VM Disk Space – C: \ Less than x MB —-
    If ($ShowGuestCDriveSpace){
    Write-CustomOut “..Checking for Guests with C:\ less than $MBFree MB”
    $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.DiskPath -eq “c:\” ){
    if (([math]::Round($disk.FreeSpace / 1MB)) -lt $MBFree){
    $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))
    $DiskNum++
    $MyCollection += $Details
    }
    }
    }

    }
    If (($MyCollection | Measure-Object).count -gt 0) {
    $MyReport += Get-CustomHeader “VMs with C:\ less than $MBFree MB : $($MyCollection.count)” “The following guests have a C:\with less than $MBFree MB Free. If the C:\ disk fills up it may cause issues with the guest Operating System”
    $MyReport += Get-HTMLTable $MyCollection
    $MyReport += Get-CustomHeaderClose
    }
    }

  599. John Renton

    Found this sript took a long time to run but once completed highlighted a number of issues with our environment which we were previously unaware.

    A must for any VMware Administrator.

  600. Neil Newman

    If you want the script to use the credentials you supply that are stored in the mycred.crd change the lines 701 and 712 that read

    $VIServer = Connect-VIServer $VISRV

    to

    $VIServer = Connect-VIServer $VISRV -cred $creds

  601. Dale

    I am also having the “WARNING: Unable to populate snapshot size due to ‘unsiffucient’ permissions.” despite having the appropriate permissions and running PowerCLI v4.1 – I have cleanly installed everything to a new machine and attempted to run it from there with exactly the same results – Help would be appreciated with this.

  602. Dwayne Callahan

    I had the same issue, my server is 64-bit Windows 2008 R2 and vCenter 4.1 and had issues trying to get the script to run on the vCenter server locally. I tried:

    Made sure UAC was disabled
    Made sure RemoteSigned policy was enabled
    Made sure my account was an Administrator on the server and in vCenter
    Ran command in PowerShell (32-bit) both as my account and “Run as administrator”
    Ran command in PowerShell (64-bit) both as my account and “Run as administrator”
    Ran command in VMware vSphere PowerCLI (32-bit) both as my account and “Run as administrator”
    Ran command in VMware vSphere PowerCLI (64-bit) both as my account and “Run as administrator”
    Each time I made sure to use the vCenter server and used several variations like WINs name, FQDN, localhost, and IP.

    I was never able to get the script to report more than 1 host even though I have 18 in vCenter.

    Only way I got this to work was to run the script remotely from my Windows 7 32-Bit VM.

  603. J Bell

    When I say vSphere, I mean vCenter!

    “””What are the minimum rights the account running the script requires on the vSphere server?”””

  604. J Bell

    What are the minimum rights the account running the script requires on the vSphere server?

  605. Mark

    Curious – I have iniated the script which i kicked off @ 8:33 PM EST. It is now 10:52 PM EST and it is still at Checking capacity info.. Its been on the capacity part since 8:41PM.. Is it because my environment is large or is something hanging. I do see HD activity.

  606. David Vekemans

    Hello,

    it would be nice if there was a check for SCSI LUNS with only one path.
    In our environment, all the path must be redundant. But we can not avoid a mistake from the storage team. So if we could have a check that verifies the number of path of each LUNs (this number could be a parameter). If the number is less than the parameter, then it appears in the reporting.

    Thanks,
    David

  607. Pingback: VMware vCenter CapacityIQ

  608. Ross Anderson

    Hi,

    I keep getting an error when it’s checking tech support mode against hosts in my vCenter:

    ‘VMkernel.Boot.techSupportMode’ is invalid or exceeds the maximum number of characters permitted.

    Line in script:
    $ESXiTechMode = $VMH | Where {$_.State -eq “Connected” -or $_.State -eq “Maintenance”} | Get-View | Where {$_.Summary.Config.Product.Name -match “i”} | Select Name, @{N=”TechSuportModeEnabled”;E={(Get-VMHost $_.Name | Get-VMHostAdvancedConfiguration <<<< -Name VMkernel.Boot.techSupportMode).values}}

    Anyone else come across this?

    Thanks, Ross

  609. david

    This works for me when scheduled to run locally on the vSphere server. The account details to connectt to vsphere are in the vcheck.ps1 fiel aswell

    C:\WINDOWS\SYSTEM32\windowspowershell\v1.0\powershell.exe -psc “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -noe “& ‘C:\tools\scripts\vCheck5.ps1′” INF-vCenter

  610. Jack

    Apologies…. the command above should read

    %SystemRoot%\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “ampersand(curly brackets open)C:\Batch\VMCheck5.ps1 vCentre(curly brackets close) -close”

    it appears that ampersands or curly brackets – or both – are not liked by the commenting system – so they got chopped out first time!

  611. Jack

    I’m trying to get this running again now that I’ve upgraded to vCentre 4.1 on Windows 2008. I’ve created a batchfile that contains the following:

    %SystemRoot%\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “-close”

    I’ve also got the

    add-pssnapin VMware.VimAutomation.Core

    line in my PS1 file as suggested elsewhere on this site.

    It runs perfectly if I run the batchfile interactively, but as a scheduled task, it does nothing – Powershell seems to start up (I can see the process in Task Manager) but I never get an e-mail and the task doesn’t end.

    Any suggestions?

  612. ANubhav

    Hi

    This script is awsome and works great in our enviornment. Thanks for your script.
    One of the Heading in the scripts says number of Inactive machines.

    What exactly it means that the machines are turned of or what.
    Secondly it doesnt list those VM’s. Can i have code for that please.

    Regards
    Anubhav

  613. david

    Great script, but quick question with regards to rights required to run this.

    What rights will the virtual center user require to run the script without just giving it Administrator?

    Thanks

    David

  614. Sebastian

    Hi!

    First, THANKS for this great great script!!!

    What about PortGroups? There exists a command to view this object? Deleted, Added, and so on…

    Thanks again!

  615. Rick

    I changed below to send report as attachment as Outlook 2007/10 use Word to render HTML and not IE.

    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)

    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV -body “$VISRV vCheck Report” -attachment “$Filename”

  616. Pingback: thattommyhall.com » Playing with PowerShell

  617. Tracy Conley

    This script is great and very cleanly written and well commented. You know your stuff.

    Feature Requests:
    1. Allow a comma seperated list of virtual center servers. I have multiple.
    2. allow the settings to be changed via cmdline switch. for example i may want to suppress certain part of the reports and only show them once a week.

  618. Dan

    hi,

    for the love of god i can’t get the script to run under windows 2008 R2 using the Task Scheduler.

    any help would be kindly appreciated.

    This is the batch file i’m trying to run. if i right click on the batch file, the script runs beautifully, but not under the Task Scheduler.
    ————————-
    powershell.exe -PSConsoleFile “vim.psc1″ ” & “.\vCheck.ps1” vcenter01
    ———————————–
    i have a credential file, but i keep getting a powershell credential request asking for user name and password. after entering the user credential, i see the report.

    Thanks
    Dan

  619. Bryan

    Alan,

    Great script and it’s provided me some excellent information over the last few hours that I wouldn’t otherwise have gotten.

    I’m running into two problems though:

    The first one is that it complains about some sort of root certificate issue which I’m sure is just a powershell issue so I’ll look into that next but if you have any ideas I’d would greatly appreciate it.

    The second problem I have is that I get the following error message when vCheck5.ps1 does the Snapshot Check:
    “WARNING: Unable to populate snapshot size due to unsiffucient permissions.”
    I noticed when going through the comments that I should look at upgrading the PowerCLI 4.1 to get the snapshot stuff working which I did and I’m running the script with my credentials which have Administrator access to Virtual Center so I’m a bit at a loss as to what’s going on. The ESX environment is ESX 3.5.0, 153875 and Virtual Center is version 2.5.0 Build 147633. The only thing I haven’t done is update the ESX environment which is something I can’t do at the moment due to project restrictions.

    Any suggestions would be welcome.

    Thanks,
    Bryan

  620. Results set is empty (mostly)

    Hello I am running this from the VC locally and it runs through fine (takes about 15 minutes) but the html output consistently shows that it found only 1 host, 1 datastore, 1 VM, etc. I am not sure where else to look…it is running under my user context. The box is a 2008 box and I have tried to run it under the CLI in administrator mode and regular mode. I have the scripts folder on the F: drive so I am just entering the full path to the script with a space and the VC name at the CLI command prompt. Anything come into mind that I might be doing wrong?

  621. Mark

    At the end of the script there already is code to save the file to a location. You just have uncomment the lines similar to this:
    __________________________________________________________________
    #Uncomment the following lines to save the htm file in a central location
    if ($DisplayToScreen) {
    Write-CustomOut “..Displaying HTML results”
    if (-not (test-path c:\tmp\)){
    MD c:\tmp | Out-Null
    }
    $Filename = “C:\Reports\” + $VIServer + “_DailyReport” + “_” + (Get-Date -format yyyy-MM-dd) + “.htm”
    $MyReport | out-file -encoding ASCII -filepath $Filename
    Invoke-Item $Filename
    }

    if ($SendEmail) {
    Write-CustomOut “..Sending Email”
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport
    ____________________________________________________________________

    I send the output to file in the Reports folder & e-mail daily so I can review it at a later date if needed without keeping the e-mails.

    Hope this helps…
    Mark

  622. Bolsen

    The problem with Outlook are well documented in the past 40 posts.

    The easy way to make it work in Outlook, is click the link at the top of the page that says “View in Browser”.

    But that brings up another feature request:

    – add the ability to save the report to a directory.
    – attach the report as an html file to email.

    It would be really nice if the reports could be stored on a network share, then the script sends an email saying when the report is ready.

  623. Pingback: EnterpriseAdmins.org » Blog Archive » Directory partition has not been backed up [DC=virtualcenter,DC=vmware,DC=int]

  624. Matt O

    Anyone have any issues with how the report shows in outlook? I can’t see the description of each report. The box is blank. It shows fine when I run the script and it just saves the htm file.

  625. Burak


    tien lam nguyen:

    I would like to make a suggestion. Under the snapshots section I would be nice if we could get the amount in MB of the autual size of the snapshots.
    Right now we only get the total amount of disk size

    It would be great if we could see the actual snapshot size other than whole disk size. Is this a feature?

  626. Derrick

    Al,

    Thanks for a great script. I have to admit though that I have not used it in its native form, but have shamelessly plagerised the pieces I need for my scripts. I have taken a slightly different tack (read diametrically opposite) to you with your health check script. I have created a single folder with a number of small scripts that do various pieces: some report on disk space to the SAN administrator, some report machine creation to the Infrastructure Manager and one of them even trawls logs, events and VM properties for information to include in custom fields in vCenter. This folder in itself simply becomes the scheduled task by running powershell across the folder using the following command : “Get-ChildItem *.ps1 | Invoke-Expression”. Works for me anyway and Thanks.

    Derrick

  627. Bolsen

    Feature request:

    – Add “Top 10” VMs with highest read IOPS and write IOPS
    – Add “Top 10” VMs with highest read latency and write latency
    – In the prediction report – have the report include average VM disk size in the calculations.
    – Add a section for Host hardware status alerts

  628. Bolsen

    Here’s what I had to do to get v5 to work as a scheduled task with Windows 2008 R2.

    Problem – The script would not run as a scheduled task. It would run from the command line.

    Solution – Manually run the script from command line so it creates the .CRD file. Then modify $CredFile so it has the full path to the .crd file.

  629. Derek

    Yes, please correct the base script so the HTLM renders properly in Outlook 2007/2010. Also, can you test against 4.1? Looks great!

  630. Bernt

    Hi,
    Your script is amazing and very useful 🙂

    In my environment we have a lot of lab VM’s with many snapshots.
    I would like to exclude them from the snapshot report.

    Is it possible to exclude a list of VM’s not to report on, similar to the $LVMDoNotInclude = “Template_*|VDI*” variable?

  631. Marty

    Great script. I would like to make a suggestion for a future enhancement. Can you split the HTML and SmtpMail functions into their own module or ps1 file so that it can be imported into a session and used by other scripts. I have used your functions to build other HTML reports and would like to keep up with any enhancements to it in the furture without having to dowonload the script and remove the rest of the script.

  632. Pingback: Tweets that mention vCheck (Daily Report) | Virtu-Al -- Topsy.com

  633. Kumar

    Statement correction:

    iF We can able to get the above info, easily we can able to administer ESX server. That report should have only issues not the information like vCheck5.ps1
    ###########################################################
    iF We can able to get the above info, easily we can able to administer ESX server. That report should have only issues like vCheck5.ps1 not the information of ESX like other Daily health check scripts…

  634. Kumar

    All,
    I run this script for ESX server.. it is showing Host minimal info and VM /DB info.. but am looking for a report which include below info of ESX server. Can some one please see below and help me if any script available.

    1. ESX Partiton info
    2. Root password age notification
    3. Esx current patch level / updates
    4. VMKernal errors
    5. ESX uptime
    6. ESX Hardware issues
    7. Security Warnings

    iF We can able to get the above info, easily we can able to administer ESX server. That report should have only issues not the information like vCheck5.ps1

    PLEASE HELP ME IS ANY ONE HAS LIKE THAT

  635. Kumar

    We can able to see Letters in black in Outlook but background is Missing…. If background cloour also come.. it will look gr8.

    Any suggestions pls.


    Brian:

    I read other posts here and by changing the font color under .dsp from FFFFFF (White) to 000000 (Black) the text now shows up great in Outlook.

  636. Kris

    can someone suggest me how can i run this script using task schedular? this script requires user Intervention to provide user account details.

    can we use stored creds in .xml file and run the sript in schedules?

  637. Pingback: vCenter does not support hosts of this type (VMware ESX 4.0.0)

  638. michael

    does the script re-prompt for credentials on the vCenter services and event log sections for anyone else? i even tried to hard code in the -user and – password fields to no avail.

  639. Mike

    I recently started testing this version, having used version 1.2 for a while now.
    Amazing work, however this one seems to take about 5 hours on the capacity info check, and then had some memory failure issues when checking snapshots.
    Have you seen this before?

  640. Traveller

    Whilst updating our servers to v4.1 I had a thought 🙂

    It would be nice if the vCheck script could indicate which version the Hosts are running. Maybe have something that would show the highest version used in the cluster and which machines are not at that revision.

    That way you would not have to keep updating the script with which version you want to check for. Maybe that should be an option as well for those who want tighter control.

  641. Mike

    Hi!
    thanks for this great report. i’m using it since version 3.
    now i have updated it to v5 but still now i have issues with it.

    it seems that the report is only generating only cluster in vcenter (only 5 from 70 hosts) so the report not finished.

    on excecuting there are no errors within runtime of the script.

    do you have some ideas?

  642. kevin

    To show if tools need to be updated.
    Add this to turn on in the correct section
    $Showtoolsupdate = true

    Then add

    # —- VM Tools update —-
    If ($Showtoolsupdate){
    Write-CustomOut “..Checking VM Tools Out of Date”
    $UpdateTools = @($FullVM |Where {$_.Guest.ToolsStatus -eq “ToolsOld”} |Select Name, @{N=”Status”;E={$_.Guest.ToolsStatus}})
    If (($UpdateTools | Measure-Object).count -gt 0) {
    $MyReport += Get-CustomHeader “VM Tools Updates : $($UpdateTools.count)” “The following VMs have issues with VMtools and need to be updated”
    $MyReport += Get-HTMLTable $UpdateTools
    $MyReport += Get-CustomHeaderClose
    }
    }

  643. kevin

    to shoh is tools need to be updated.
    Add this to turn on in the correct section
    $Showtoolsupdate = true

    Then add

    # —- VM Tools update —-
    If ($Showtoolsupdate){
    Write-CustomOut “..Checking VM Tools Out of Date”
    $UpdateTools = @($FullVM |Where {$_.Guest.ToolsStatus -eq “ToolsOld”} |Select Name, @{N=”Status”;E={$_.Guest.ToolsStatus}})
    If (($UpdateTools | Measure-Object).count -gt 0) {
    $MyReport += Get-CustomHeader “VM Tools Updates : $($UpdateTools.count)” “The following VMs have issues with VMtools and need to be updated”
    $MyReport += Get-HTMLTable $UpdateTools
    $MyReport += Get-CustomHeaderClose
    }
    }

  644. RobVM

    One more item. Would it be possible to check to see if the host is reporting hardware sensor info? There have been a few times where for whatever reason, the host doesn’t report this, and it does not raise an alert in vCenter. Then you try to run VUM and it won’t work properly because it can’t detect the power state of one of your hosts. This would be a big help!

  645. RobVM


    Brian:

    I read other posts here and by changing the font color under .dsp from FFFFFF (White) to 000000 (Black) the text now shows up great in Outlook.

    Yes, the display of this report in Outlook 2007 is a pain. The table borders all show up with no content. Would it be possible to add the font color as a variable, and perhaps use that -fragment function for the HTML output? Otherwise this script works fantastic for us…thanks Al!

  646. Chris

    Is v5 only for vSphere? I have been using v3 with VI 3.5 with no problem but with v5, I am getting math errors. I am using ps2 and the latest PowerCLI.

    Attempted to divide by zero.
    At :line:571 char:73
    + $MyDetails.PercFreeSpace = [math]::Round(((100 * ($ds.FreeSpaceMB)) / <<<< ($ds.CapacityMB)),0)

  647. vincent

    I am trying this on another virtualcenter server and i get a message saying “the script is not digitally signed and so it will not run”.
    Please help.

  648. vincent

    I am having some issues.

    What happens is that i am not able to get the script running.

    It says “connection to VI server” for a few seconds and then comes back to the command prompt. I do not find any HTML report.

    I have set all things correctly as i know. These are :

    1. Setting done to make the report display on screen.
    2. Setting done to enter my username in the script that would be used to connect to the virtualcenter server.

    Please help.

    Best Regards

    Vincent S

  649. tien lam nguyen

    Hi, There

    your script is great. I have been using it for the last week.

    I would like to make a suggestion. Under the snapshots section I would be nice if we could get the amount in MB of the autual size of the snapshots.

    Right now we only get the total amount of disk size

  650. Virtu-Al

    There is a problem with the get-snapshot cmdlet in the current release, look out soon on the vmware site for a new version of PowerCLI 😉

  651. michael

    love this script. been using it for some time but noticed it hangs on ” ..Checking Snapshots” section, even if left for hours. it there any way to tell what it might be hung up on?

    thanks.

  652. Virtu-Al

    You read my mind 😉 yes there is, you can actually use my plugin generator script to add this and just amend the code so it creates the same html page each time.

  653. Kris

    I tried running the script, but it’s been at “…Checking capacity info” for more than 40 minutes now. Is this normal?

    Thanks,
    Kris

  654. Robert van den Nieuwendijk

    In PowerShell V2 the ConvertTo-Html cmdlet has a -Fragment parameter that “Generates only an HTML table. The HTML, HEAD, TITLE, and BODY tags are omitted.”. I don’t know if this parameter is present in PowerShell V1. With the -Fragment parameter you can rewrite the Get-HTMLTable function into:
    Function Get-HTMLTable {
    param([array]$Content)
    $HTMLTable = $Content | ConvertTo-Html -Fragment
    Return $HTMLTable
    }

  655. Brian

    I read other posts here and by changing the font color under .dsp from FFFFFF (White) to 000000 (Black) the text now shows up great in Outlook.

  656. Brian

    Matt, I am having the same issue in Outlook. What did you modify to make it viewable in Outlook? Thanks

  657. Matt


    Matt:

    Has anyone figured out a way to make this render properly in Outlook 2007/2010? I’m using the latest version of the script and I see the comment where you can modify the COLOR: to black so that it displays properly. I confirmed mine is set that way and I still cannot view this in Outlook.
    It looks great as HTML. Someone else had the suggestion of providing an option to just attach it as an HTML file. Is that possible?

    Or you can actually modify the correct part of the script to make it work. I can confirm that the workaround does in fact work.. Sorry about that.

  658. Matt

    Has anyone figured out a way to make this render properly in Outlook 2007/2010? I’m using the latest version of the script and I see the comment where you can modify the COLOR: to black so that it displays properly. I confirmed mine is set that way and I still cannot view this in Outlook.

    It looks great as HTML. Someone else had the suggestion of providing an option to just attach it as an HTML file. Is that possible?

  659. Pingback: VMware Snapshot Alerting and Reporting | VirtualPro

  660. Tim

    Hey Al,

    Would it be possible to include the option to exclude snapshots with a certain name? i.e replica_*

    We use your report on View environments and the report is constantly reporting the View snapshots.

    Thanks.

  661. Steve

    Oh wait, no panic. As we’re working with MSSCCM at the moment, I’d forgotten to reinstall a necessary component on my PC (using it for testing so was rebuilt).
    Thanks!

  662. Steve

    Are you pointing this at your vCenter server or a host? I’m having trouble, I get an error:
    The Connect-VISERVER Cmdlet did not work, please check you VI Server.

    We’re running vSphere 4. Does it need to be run on the vCenter server itself?

  663. Reg

    Is it possbile to have the html report only capture issue or misconfigurations? As more functionality is added to the script I can see myself scrolling through the full report looking for warning or issues only.

  664. Virtu-Al

    Sounds great, can you email them to me so I can see what you have done, I have a few good ideas for this myself but would be interested in what you have done.

  665. Mark

    I have updated vcheck5 to user powershell v5 advanced parameters instead of all the variables set at the top of the script. This will allows for better long term maintenance for everyone using the script. Thus everyone does not have to edit the new script when it comes out. They should be able to pop it in, possibly adding new switches for the new features only. Email me if you are interested.

  666. Grant

    Hi – Firstly – Fantastic script – I have learnt a huge amount just following this thread!.

    Here’s my issue (sorry!) – I hve a number of VM’s with a C:\ of less than 500mb – So, I set the threshold to 700 – nothing comes up – But I noticed that the D:\ of the VM’s in question have GB’s of space – Does the VM space check report per volume or in total??? – If I make the freshold 400000 then it reports everything (which is what I would expect) – can anyone let me know what I may be doing wrong? Cheers

  667. Chris

    Great script. Thank you. I am interested in also getting overall LUN Disk space usage as an informational value. Another thing – it shows the VM Hardware version as 4 for me, but I would also like to see which ones are on 7 already.

  668. Rob

    “WARNING: Unable to populate snapshot size due to insufficient permissions” … I too get this error on some vm snapshots in the “Checking Snapshots” routine. Problem seems to be just snapshots on vm’s configured with multiple vdisk located on different datastores. Snapshots on vm’s configured with single vdisk or mult vdisk on same datastore produce no error. I have admin rights and can browse all datastores.

  669. Ceri Davies

    All of my Solaris guests show that they have no disk space free, although this isn’t the case. They use ZFS root.

  670. Luca

    I have created a windows scheduled task with the following run line: %SystemRoot%\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1” -command “” it does not seem to do anything when run?? any ideas?

  671. Luca

    Does anyone know how to automatically connect to your VC server “$VISRV”. Where would you place the name of the Virtual Centre Server in the script as V5 as is won’t run as a scheduled task??

  672. Daniel

    Another approach is to check for free MB AND free %:
    Foreach ($disk in $VMdsk.Guest.Disk){
    $dskPercFree = [math]::Round($disk.Freespace/$disk.Capacity, 2) * 100
    if ((([math]::Round($disk.FreeSpace/ 1MB)) -lt $MBFree) -and ($dskPercFree -lt ($PercFree))){

  673. Pingback: Update to exclude mounts from vCheck5 « SYSXPERTS Blog

  674. Paul V (sysxperts)

    We were getting a lot of linux guests reporting on low disk space for /boot so we decided to clean up and remove /boot from the checks by changing:

    Foreach ($disk in $VMdsk.Guest.Disk){
    if (([math]::Round($disk.Capacity/ 1MB)) -lt $MBFree){

    To this:

    Foreach ($disk in $VMdsk.Guest.Disk){
    if (([math]::Round($disk.Capacity/ 1MB)) -lt $MBFree -and $Disk.DiskPath -ne “/boot”){

  675. Kevin Hamilton

    Top script Alan use it manually and works a treat. Having issues getting it running as a scheduled task. It asks for the creds which I put in and goes through but comes through to mail saying the connect-vi server cmdlet did not work please check you VI Server

    I know the VI-Server is correct as I get it working direct from vSphere Power CLI, I know i must be missing something simple here but lost HELP please.

  676. Virtu-Al

    That is a nice reference, thanks for that, I will make sure I run the next version through there first.

  677. Drew

    When I run script I receive this message:

    The Connect-VISERVER Cmdlet did not work, please check you VI Server.

  678. shahid

    This is great -all runs smooth just one problem that i am experiencing – i get this error “WARNING: Unable to populate snapshot size due to insufficient permissions” – any thoughts ?

  679. Traveller

    Another thing that would be nice to check is the status of VMTools installations.
    With Linux systems it is easy to forget to end the installation mode and until then the VM cannot be migrated.

  680. oogabooga

    Dude, I’ve been listening to get-scripting and decided to come check out your script. This is insanely good and useful.

    Thanks so much.

  681. Andreas

    runas is a nice idea. But don’t forget to cd (change directory) to the same folder as defined in the scheduled task under “Start in” or your stored credentials file will be in the wrong place.

  682. Traveller

    @bryan & @Andreas
    I had the same issue of the script prompting for the password.
    What I had done was to create a local account on the vCenter cerver for the script to use BUT I had forgotten to grant that use any rights in vCenter itself.
    Once the rights were granted the script ran fine. The only thing I now need to do is work out what rights it needs so that I can reduce it to the bare minimum..

    @dsammich
    We also have a similar sized environment an it takes about 15 minutes to run.
    Another alternative to Andreas’s solution is to start a command prompt as the user that the script will run using runas, then run the same command as specified in the Schedule. Once you get that working then start on the scheduled task.
    I know it sounds silly but Its so easy to forget to test the script as the user that the Scheduled taks is running as… (one dunce here 🙂 )

  683. Andreas

    @Mark

    Thank you for the info. Tested and working 😉

    @dsammich

    You can put a “cmd /c” in front of the scheduled task and and append somthing like “>vcheck.log”. Then you can see what your script is doing.
    I’ve done this and my script was stopping at the “vCenter Services check”. The Problem was that the Task was running as a lokal admin user. After changing to a Domain Admin User the script was running fine.

  684. Richard

    I just wanted to say thank you and to all the folks who worked on this script it great. It will not only help me in administration of my VM’s but it will also help me in better understanding and learning PowerShell. I am pushing myself to learn Ps with this script I can use it as a example. You did a lot of great work on this and it goes to show what can be done with PS.
    Thanks Rich

  685. Mark

    @Andreas
    From an earlier post:
    To test for two ntp servers you have to do it like this:
    $ntpserver = “ntp1.domain.nl|ntp2.domain.nl”

  686. Feol

    First of all, this is really a great tool / check

    As far as I can tell I’ve run into 3 minor issues. Two of them are related to a fault-tolerant guest (at least I think so).

    The vCheck gives us some empty results. I think this is because of the secondary VM with the same name.

    It tells us the VM has less then 10 MB of diskspace left (and shows only the name of the machine)
    and it tells us this machine has a VM Tools issue. Again no additinal details are shown (only the guest name).

    and one general for the NTP check. We’ve gotten multiple NTP Servers and then it doesn’t think it is complient. Is there a special way to tell the script it should check for 2 or more NTP servers or is this not (yet) part of the check logic?

  687. dsammich

    How can I tell if it is running and what % it has completed? I have small environment with about 6 ESX hosts and around 50 virtual machines and I have yet to see anything and it’s been running for about 1 hour or so?

    Nice job on this BTW!

  688. Andreas

    Nice Script. But how to check more than one NTP-Server? Our ESX use two TimeServers. I tried to add them with comma and space seperated. Even if I enter only one of them, I allways get an error from your script.

  689. David

    I’m trying to setup the script to run as a scheduled task and it keeps failing to run.

    The contents of the batch file is:

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” “& ‘C:\Temp\Daily_Scripts\vCheck5.ps1′”DFCU-PVC01

    The error I am getting is:

    The term ‘param’ is not recognized as the name of a cmdlet, function, script fi
    le, or operable program. Check the spelling of the name, or if a path was inclu
    ded, verify that the path is correct and try again.
    At C:\Temp\Daily_Scripts\vCheck5.ps1:3 char:6
    + param <<<< ( [string] $VISRV)
    + CategoryInfo : ObjectNotFound: (param:String) [], CommandNotFou
    ndException
    + FullyQualifiedErrorId : CommandNotFoundException

  690. Pingback: Free SAN Monitor for DS3300, MD3000i and others | VMtoday

  691. bryan

    when i set this script as a scheduled task in windows 2k3, it runs but when it gets to the last few services it prompts for a password, I type it in thinking it will save it in the mycred.crd file but it prompts everytime. I have validated that the credentials are correct. I tried specifying also a different path in the vCheck file for where the .crd file is located. Still no luck. I also tried recreating the .crd file and that did not solve it. I am giving a user with Domain Admin rights as well when it prompts for the vmconsole. Any help would be great. Great script!

  692. Virtu-Al

    A great idea… already have a ton of features for the next version. Thanks for the addition.

  693. Jon

    I was wondering if this script could add a check for the following information:

    host connected serial ports
    host connected parallel ports
    number of LUNs per cluster

    I have found when server admins do a p2v the leave serial and parallel ports connected causing DRS or vmotions to fail just like floppies and CDROMs do.

    This has been a great utility. The universe owes you a ton of good karma for creating it.

    Thanks,

    Jon

  694. Jeramey

    I would like to run this script based on the folder level or datacenter level anyone doing this or does anyone have any suggestions

  695. Paul V (sysxperts)

    I chose to go with an attachment like shartma but did not want a copy of report in body so I changed:
    if ($SendEmail) {
    Write-CustomOut “..Sending Email”
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport $Filename
    }

    to:
    if ($SendEmail) {
    Write-CustomOut “..Sending Email”
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV “vCheck report for $VISRV is attached” $Filename
    }

  696. ComeHomeBillyB

    Is there a specific reason why you use

    705: $APPPATH = “C:\Documents and Settings\” + $USER + “\Application Data”

    Instead of just %appdata%?

  697. Rene

    Can anyone help with this issue? Thank you, Rene

    Missing file specification after redirection operator.
    At C:\DOCUME~1\user\LOCALS~1\Temp\5e580c66-6ad6-40be-afb0-6a0974d0faa2.ps1:25
    0 char:102
    + <<<

  698. bwuch

    I love this script! I run it every night and review the output in the morning. I recently shared the link with some co-workers and they had suggestions. The good news — the script already checks for what they wanted. The output excludes any check where 0 results were returned. Would it be possible to add a setting that would allow all executed checks to appear in the report — even if no results were returned?

  699. Traveller

    Loyus Notes 6.x also fails to diskplay the report nicely.

    @shartma. Thanks for the e-mail attachment code. Just one comment, You MUST set $DisplaytoScreen = $true otherwise the attachment is not created therefore cannot be sent 🙁

    Another quick and dirty way is to add the report generating code to the send mail section.

    if ($SendEmail) {
    Write-CustomOut “..Sending Email”
    if (-not (test-path E:\temp\)){
    MD E:\temp | Out-Null
    }
    $Filename = “E:\temp\” + $VIServer + “vCheck” + “_” + $Date.Day + “-” + $Date.Month + “-” + $Date.Year + “.htm”
    $MyReport | out-file -encoding ASCII -filepath $Filename
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport $Filename
    }

  700. Ccalvin

    I really enjoy using this script as a base for my daily audits, but one thing I’d like to have added (so I don’t have to do it myself after each update) is the ability to set an array to limit scope to particular containers. I have folders, datacenters, and clusters that have varied administrative groups so limiting the report details to their systems is vital.

  701. Ccalvin

    looks like Line 1304
    $Details = “” | Select-Object Name, Message

    should be:
    $Details = “” | Select-Object Name, Message, Reason

  702. Mark

    For Kevin & Paul with the missing headers issue, I have changed the font color under .dsp from FFFFFF (White) to 000000 (Black) so the text now shows up. When the issue is resolved I plan on changing back to white but for now it works and I can see them.

  703. Owain

    Had the same issue with capacity planner listing infinite VM’s left.
    Found this was caused by the counter – $CluMemUsage – not having a value hence causing a divisable by 0 situation making the final value infinity.
    This was caused by the counter – mem.consumed.average – not being enabled by default at Statistics Level 1 in the VC Management Sever Configuration (under the Administration menu in the VC) changing this to Level 2 for Days & Weeks enabled the counter for the required period in the script and this now returns a proper value for capacity.
    I’m running VC 2.5 and making the above change fixed my issue I think this counter maybe enabled by default in vSphere? So may not be the fix for this.

  704. Paul

    I am experiencing the same issue at #6, where there are no headers for each section in email mode.

  705. rene

    Hello, I am getting the following error when running the script…Anyone else has this issue?
    How did you fix it? Thank you

    Missing file specification after redirection operator.
    At :line:250 char:102
    + <<<<

  706. kevin

    Hi seems when i run the script in email mode it does not have any headers generated as compared to the report generated in html view mode

  707. Will Kea

    Love this site. I came to v5 in a round about way since I discovered you via google search. I had a terrible time finding the download link for this vCheck tool. Is that by design? Is it possible to add a link to the master lay out that sends you directly to the Download page?

  708. chris

    Fixed my own problem:

    I needed to change $CredFile = “.\mycred.crd” to an absolute directory: $CredFile = “c:\vCheck\mycred.crd” and it worked perfectly.

    This script is great; thanks so much.

  709. chris

    RE scheduled task – Is there a certain directory I should run the script from (the first time?) to properly set the crd file? I am able to get the script to run sucessfully from the command line, but from scheduled task it just hangs. I have tried the myriad ways described above.

    It says that the running task is ‘powershell.exe’ but I don’t see a connection inside vSphere until after I ‘end’ the task.

    Am I missing something?

    Thanks.

  710. Simon McFarlane

    Consider replacing:

    Function Get-HTMLTable {
    param([array]$Content)
    $HTMLTable = $Content | ConvertTo-Html

    With:

    Function Get-HTMLTable {
    param([array]$Content)
    $HTMLTable = $Content | ConvertTo-Html -Fragment

    This may reduce the number of “-replace” operations required.

    – Simon

  711. Ed

    A possible addition for version 5.1 – a check for VMs with resource limits attached. Sometimes if you P2V a system, resource limits will automatically apply, which can cripple any potential performance gains.

    # —- Resource Limit Check —-
    If ($ShowResourceLimits){
    Write-CustomOut “..Checking for Resource Limits”
    $VMResourceLimits = @(get-vm | get-view | where {$_.ResourceConfig.CpuAllocation.Limit -ne -1 -or $_.ResourceConfig.MemoryAllocation.Limit -ne -1} | Select Name, @{N=”CPULimit”;E={$_.ResourceConfig.CpuAllocation.Limit}}, @{N=”MEMLimit”;E={$_.ResourceConfig.MemoryAllocation.Limit}} | Sort Name)
    If (($VMResourceLimits | Measure-Object).count -gt 0){
    $MyReport += Get-CustomHeader “Number of VMs with resource limits : $($VMResourceLimits.count)” “VMs with Resource limits”
    $MyReport += Get-HTMLTable $VMResourceLimits
    $MyReport += Get-CustomHeaderClose
    }
    }

  712. Robert-NL (rvdnieuwendijk)

    Found this missing from the task enablement section:

    # VCB garbage
    $ShowVCBGarbage = $true

  713. Mark

    We have 2 environments.
    Environment 1, 9 hosts, 103 vm’s, 27 minutes
    Environment 2, 7 hosts, 22 vm’s, 17 minutes

  714. Robert-NL (rvdnieuwendijk)

    I run vCheck in three environments. I will show the times for all three:
    Environment 1, hosts 2, VMs 12, time 0 hours 14 minutes
    Environment 2, hosts 16, VMs 163, time 1 hour 20 minutes
    Environment 3, hosts 13, VMs 120, time 2 hours 34 minutes

  715. KW

    Can anyone let me know how long does it takes you to run this? If you can include how many VMs and hosts you have that would be helpful.

    I can’t get the script to run in less than 8 hours.

    Thanks.

  716. shartma

    I was able to get the file attached by modifying the following function.

    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)
    }

    and then changing the $sendmail output.

    if ($SendEmail) {
    Write-CustomOut “..Sending Email”
    send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV $MyReport $Filename
    }

  717. James Davis

    Found this missing from the task enablement section:

    # Show Over Allocation
    $ShowOverAllocation = $true

  718. KWH

    I know im doing something done, but I keep getting “The Connect-VISERVER Cmdlet did not work, please check you VI Server ” when i try to invoke the script

  719. Robert-NL (rvdnieuwendijk)

    @Ed

    To test for two ntp servers you have to do it like this:
    $ntpserver = “ntp1.domain.nl|ntp2.domain.nl”

  720. Russ

    In my testing, it looks as though the outlook issue may be related to the using two classes for some of the HTML elements. I am thinking that outlook does not like this.

    For example, in the Function Get-CustomHeader0, there is the header tag with the CSS class defined as class=”dsp dsphead0″. This is perfectly acceptable, and basically says to the HTML parser that there are to CSS classes for this element. If any rules overlap between the two the class that is defined last will take precedence.

    I took the definition of dsp and pasted it into the dentition’s for dsphead0 and dsphead1. After this, my outlook HTML was better. The colors were correct, but the fonts, sizing and placement are a little off. I will play around with it some more as time allows and if I find anything, i will post here.

    Thanks!

  721. Pete

    This script looks great, but unfortunately, I’m getting an error when pulling the ScsiLunPaths:

    12:39:20 PM ..Checking Hosts Dead Lun Path
    Object reference not set to an instance of an object.
    At :line:903 char:26
    + $esxluns = Get-ScsiLun <<<< -vmhost $esxhost |Get-ScsiLunPath

    The host it's erroring out on is a boot-from-san ESXi 4.0 U1 host (in case that makes a difference)

  722. Ed

    I am having problems with the NTP setting in this script. I have 2 NTP servers, and no matter how I add them into the script (a single string, comma delimited, as an array, etc…), it still reports all my hosts as wrong.
    Am I missing something here?

  723. Pingback: Episode 108 – SharePoint 2010 with Gary LaPointe « PowerScripting Podcast

  724. Tuc

    No, infact, due to some oddity I rebooted my machine. I eventually had to “false” this and CPU Usage.

    Is there a way to find out what didn’t go right?

    Thanks, tuc

  725. Jeramey

    I have another question / request. What would I have to do to add a parameter for a specific datacenter? My environment has 8 datacenters and I would like to break the reports down by datacenter.

  726. KW

    Update: I eventually killed it after about 7 hours. It was on ‘VM CPU Usage’ and hadn’t progressed in over 2 hours.

    I have PowerShell v2, Windows 2K8 x64, vCenter 4.0.0, PowerCLI v4.0 U1. Also I disabled the IE certificate setting that is supposed to speed it up.

    Any idea why it is taking so long?

  727. KW

    How long is it taking you guys to run this? I was using version 3.0 prior to this, and it would take roughly 1 hour 45 minutes under that version. Version 5 has been running for nearly 4 hours, and still is not finished.

    I’ve got about 100 hosts and 1500 VMs.

  728. Jeramey

    Is it possible to specify a single cluster or specific clusters to run the daily check against?

  729. Aleksandar

    @cepelo

    I had the same problem. Are you trying to run it twice in same PowerCLI session? If yes, try to close PowerCLI and start vCheck again 🙂

  730. Tuc

    How long should it take to run? I started at 2:50, at 2:51 it says “..Checking Capacity Info” and almost an hour later its still not progressed.

    Thanks, Tuc

  731. cepelo

    When i run the script with my vserver name, i get an email saying “The Connect-VISERVER Cmdlet did not work, please check you VI Server. ” When I open the vSphere powerCLI i can connect to the same vserver name, but it takes a few seconds due to a certificate warning. I tried making the script wait, but that didn’t help.

    What could be wrong? Thanks so much for your work on this.

  732. Daniel

    I made some investigation and it seems like most of the counters and fields are missing in 2.5 API. I don’t even get (Cluster).Summary

  733. Robert-NL (rvdnieuwendijk)

    I have the same problem as Daniel has with infinity in the Estimated Num VM Left (MEM). But only on VMware VirtualCenter version 2.5.0 servers. It works ok with a VMware vCenter Server version 4.0.0. I will send you a screenshot with the problem.

  734. Robert-NL (rvdnieuwendijk)

    I have another suggestion for a new feature in the Capacity Planner Info section: Estimated New VM left (Storage).

  735. Daniel

    Great Work! Unfortunately Capacity Planner Info displays “Estimated Num VM Left (MEM): +infinite (translated, originally +unendlich (german))”. Any idea?
    Cheers, Daniel

  736. George

    Great script, but I have a couple of questions…

    1) to fix the display issue within outlook, is it possible to have the html file attached to the message instead of embedded?

    2) in our environment, we maintain two datacenters within vmware. Is it possible to have this run only for a specific datacenter? I was looking through the code to try and tweak some of the powerCLI stuff, but it looks like you may be using some other method of retrieving the data.

    Thanks for the cool script!

  737. Pingback: vCheck v5 Script now Available «

  738. Virtu-Al

    @Victor

    Looks like the smtp settings are incorrect or you require a secure connection to your smtp server.

  739. Robert-NL (rvdnieuwendijk)

    @mntbiker5

    I now see that the ampersand and curly brackets are special characters for the website software. I try in words:
    -command “ampersand curly-brackets-open C:\vCheck.ps1 vCenterServer curly-brackets -close “

  740. Robert-NL (rvdnieuwendijk)

    @mntbiker5

    The website software cut a piece of the command line. You have to replace the -command “” part with this:
    -command “”

  741. Robert-NL (rvdnieuwendijk)

    @mtnbiker5

    This is the command line we run as a scheduled task:
    %SystemRoot%\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “”

  742. mtnbiker5

    Looks great though both web and email! Can someone post a sample command line to run as a scheduled task?

  743. Virtu-Al

    Aleksandar,

    Yes you can do that but I think I will see if I can fix it first.

    Alan

  744. Virtu-Al

    @Pizang, yeah I was going to but it got to the point where I had added so much I just wanted to get it out 😉 Perhaps 5.1 will include this !

  745. Pizang

    Alan,

    As I have written after U1 update everything seems to work just great. Maybe you should add some compatibility check to this script?

  746. Aleksandar

    Hi Alan, great script 🙂 I also have the same problems as Robert, html report in Outlook 2007 isn’t readable as generated file seen in IE. Is it possible to send generated report file as an attachment?

    Regards, Aleksandar

  747. Virtu-Al

    @Pizang

    The only time I have seen this before is when people are not running PowerCLI 4.0 U1, have you updated PowerCLI to the latest version ?

  748. Pizang

    Self-correction. Problem with TotalMemMB etc. was due to old version of PowerCli. After U1 upgrade everything is detected properly. Great script just became even greater 🙂

  749. Virtu-Al

    @Robert-NL

    Thanks for the investigation, yes it does look like that, I will have a go at making it compatible whilst also trying to keep the format. …. 5.1 here we come !

  750. Pizang

    Great script! I see one issue in my small environment in Host overcommiting memory section. There is no numbers in TotalMemMB and TotalUsedMB. TotalAssignedMemMB seems to has a proper value. Eventually I have 2 overcomited hosts.

  751. Edward Conde

    Hey Alan,

    This is a great script with tons of info… Is there going to be an updated powerpack for powergui that will include this vcheck? Also I also manage 3+ VM infrastructure and growing. I would like to also have a copy of the script that can run on multiple VC Infrastructures.

    Thanks!

  752. Robert-NL (rvdnieuwendijk)

    I did some more investigation. The problem seems to be that in Office 2007 the background colors are not shown. And you can’t read white letters on a white background. I found a workaround by changing the COLOR: in the .dsp section to #000000, which is black. It still doesn’t look very nice in Office 2007. But now I can read the headers in the e-mail.

    Regards, Robert

  753. Robert-NL (rvdnieuwendijk)

    Awesome script Alan. I’ve been using it since version one and will use this version from now on. I have found a problem though. If you send the output to e-mail and open the e-mail in Outlook 2007 it does not show the contents of the header and comment lines of each section. If I save the e-mail as .html and open it in Internet Explorer 8 it is ok. This might have to do with the “Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007”. See: http://msdn.microsoft.com/en-us/library/aa338201.aspx. I haven’t found exactly what the problem is yet. But it has probably something to do with the CSS section of the script being not compatible with Outlook 2007.

    I also have a suggestion for new features. I would very much like the things included that are in the RVTools vHealth tab and not in vCheck yet. Specially zombie VM’s, zombie vmdk files and zombie templates.

    Regards, Robert

  754. Pingback: Alan Renouf – vCheck version 5 « powercli.co.uk

Leave a Reply to Jaap

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.