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

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.

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

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.

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:

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

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 ="[email protected],[email protected]"

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

## 900 thoughts on “vCheck (Daily Report)”

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.

2. Hi, thanks for your great work with the scripst.
Just a simple question the report work on the vCenter 7.0? had did tested anyone?

3. Krish says:

Is there any updates with powercli version 12

4. Raju Banerjee says:

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.

1. Yes, you can adjust the script in the plugin

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

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

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

7. Troy Edwards says:

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

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

9. Vithoba says:

Hi,

10. Aludden says:

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

1. sokimex says:

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.

11. Hans says:

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 12. Sachin Dewan says: Can the vCheck report run from jump host that has connectivity to vcenter server OR has to be configured on the vCenter server? 1. Sachin, on a jump host, I wouldn’t run it on the VC as it will take away valuable resources from the vCenter servers 13. Mike says: 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 1. Jimmy says: I have the same issue 14. Andy Miller says: Is there any plugin or module that vCheck will check hardware status as well? Something to notify about real hardware issues?? 1. usersc says: Yes I want to know is there any module or plugin to check the replication status of vm and also the xclarity critical alerts 15. shaik afroze says: From powercli ,how to create user , networkpool in vcloud director > kindly provide solution for this 16. shaik afroze says: 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 1. Oh that’s a shame, I guess his blog disappeared. 17. tom says: 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…?? 18. Nandeesh says: 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 19. AndrewL says: 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.

20. Howard says:

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

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

21. zukic says:

this might be a stupid question but does vcheck work with vmware 6.0 update 2 and 6.5 ?

1. Erik Small says:

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.

2. Justin C says:

yep just used it then

22. Andres says:

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

23. Marc says:

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

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

2. Chris K says:

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.

24. Harish Kumar J says:

Hi

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

ERROR 1:
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.
+ < <<<
+ 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

25. David says:

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

1. Hi David,

vCheck does not change any setting on your servers. It just wants to know what the correct settings are so that it can check them against your servers.

Regards,
Robert

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

27. Chris G says:

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.

28. Ryan Barlow says:

Hello, I am having issues with the script not saving credentials. Can someone help me.

29. krish says:

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

1. 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. 30. Remi says: Hi Alan, Have you got a solution to use vcheck on a VMware Appliance ? Regards Rémi 1. Harry says: 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. 31. Swifter says: 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 32. Brandon says: A couple little bugs that I have found while creating/editing plugins and cant seem to track down where to fix in the code: 1. If your [count] is less than 2, it does not work correctly. I have a plugin with only 1 result and the [count] is blank. 2. If your results table only contains 1 column, it strips the column name and replaces it with an asterisk (*) (I’ve found a few other bugs that I have corrected, for example: The plugin report does not seem to actually display in order. This may be due to having$ListEnabledPluginsFirst enabled, so I added “,Name” to the sort options)

1. Chris Carmichael says:

Upgrade your Powershell version. Sounds like you are still on v2. Use WMF 5.0 and the ($obj).count problem goes away. Your other issues might also. I don’t know that off the top of my head. 1. Brandon says: 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. 33. Sunil Patil says: 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. 34. Ernie says: 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.

35. Ram says:

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

36. venkat says:

Hello alan,

I am getting this foreground color error.

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

Can you please let me know what can be changed.

Thanks
vKar

1. Pete says:

I’m getting the same error. Did you get this figured out?

37. Joe says:

Getting duplicates on everything as well. Any idea why?

1. Ram says:

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

2. Karl says:

Did you ever get a response?

38. GT says:

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”

39. Javed says:

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

40. Javed says:

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…

41. Brandon says:

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.

42. Ravi says:

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

43. Krishna says:

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 44. Krishna says: 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

45. danial lolo says:

can it customized to get the info for the last month ??? need your support please

46. niklas says:

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

47. MSA says:

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

48. Rosco says:

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

49. MSA says:

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

1. MSA says:

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

50. LauriN says:

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!

51. Matt Johnson says:

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

52. Joey Catanzaro says:

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.

53. Jono says:

Hi Alan

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 🙂

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

55. MikeM says:

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

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

56. Erick F says:

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

57. James says:

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 ‘

1. James says:

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

58. Jono says:

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. 59. Graham says: How would I change the port and set the smtp username and password for sending this via e-mail? 60. 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? 61. Nishant says: when we get the vCheck for vCD 1. Already linked on this page 🙂 62. David Lister says: 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. 63. Erick F says: When running vCheck it gets stuck in ..finished calculating General information by Alan Renouf, Frederic Martin v1.2. it stays there for hours, even left it overnight but nothing happens beyond this line. 1. Fredo says: 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? 1. Jono says: Hi Fredo I ran into this at a different plugin, it went away when I installed the latest (v5.5) PowerCLI. 64. Mike says: 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? 1. Jason says: Did you have any luck on this? I got the same issue 1. Mike says: Afraid not. I haven’t had a chance to take a look at this in detail yet. 65. Bill Pendleton says: 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 1. Thank you so much for this modification! This is exactly what I needed to see. Do you know how I can get this to sort by % free instead of Number of Disks? 66. Alex says: 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.

67. Ali Kasim says:

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
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 68. 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 $email protected]\\\A\B\C”. The reason is that the names of our VMs in vSphere have spaces in them like “Win7 test” and this causes the plugin to look for “…\Win7\test” instead of “…\Win7 test”. 1. Had the same on my environment. My quick fix was to change the way it replaces contents of the path string (File “79 Find VMs in uncontrolled …” / Line 8): From: Path = (vm.Summary.Config.VmPathName).Split(‘/’)[0] -replace “[\[$]”, “” -replace ” “, “\” To:$Path = ($vm.Summary.Config.VmPathName).Split(‘/’)[0] -replace “$“, “” -replace “$ “, “\” 69. Michael Fuchs says: 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

70. Raihan says:

Great script. It does magic in a blink of eye. Thanks.

71. Neil says:

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?

1. Jay says:

$snapshotUserException =” *username*” 72. JayL_AKL_NZ says: 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?

73. Ali Sarreshteh says:

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}}}) 74. Mandeep says: Hello, What are the minimum permissions required at VC ti run vCheck? Thanks Mandeep 75. 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. 1. Awesome, would love to see a NetApp version of vCheck! 76. Bryan says: Has anyone done one of these for SQL server or IIS? I think these two additions would be widely used. 77. 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”

78. Ali Sarreshteh says:

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

79. De-Mentor says:

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

1. JayL_AKL_NZ says:

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

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

81. Haim Chibotero says:

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

82. Stefan says:

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

83. Karl-Heinz Hildebrandt says:

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. 84. Chris Lawrence says: @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! 85. Nick says: @ChrisLawrence did you use multiple NTP servers using a pipe symbol (|)? 86. First I would like to say thanks to everyone who uses this script, everyone who has left a comment and a big thanks to those of you who have added your own plugins here. I am concious that this information was not getting plugged back into the script as fast as i would like so i wanted to make some changes to make that easier. From now on you can add changes and fix issues by looking at this post: http://www.virtu-al.net/2013/06/19/now-everyone-can-contribute-to-vcheck/ Thanks, and I hope this will take vCheck to the next level! 1. Chandan says: 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. 87. Gordon says: Module 79 currently has an issue – has a defined path for vm datastore instead of variables 88. Chris Lawrence says: 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.

89. Hi,

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

1. Finaly i split the vcheck :
– infra vcheck with all script about datacenter
– vm vcheck with all script about vm

next step check only selected clusters …

2. Edwin Jair Florez says:

Hi,

Did you manage to filter by Cluster?

90. Michael says:

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

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

91. Hi everybody,
I am unable to edit $VIConnection line, i dont find the line in vCheck.ps1 file? 92. Michael says: As you know, vmware5.1 use the Single Sign On and the user identification has gone to the [email protected] or fulldomainname\username format. (example. [email protected] or somecompany.com\John.Smith. My Question is this; 1.) the windows scheduled task does not seem to take that format, or is assuming/truncating it to somecompany\john.smith. This results in failure to login, thus hanging the process. is there a method or workaround to use vCheck in a 5.1 environment? 1. Matt says: Did you ever fix this? I have always loved VCheck but trying to get it to work in 5.1 as a nightmare. No matter what contation of credentials I use it will not create the XML file. Any ideas? 2. Randy says: I am going to 5.1 in the next few weeks so am interested if we know how to keep the script running… I quite like my morning email capsule from vCheck. 1. Sybux says: 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. 93. Joe says: Does anyone know if there is a way to exclude a datacenter? We have two datacenters in vcenter and one of them belongs to another group. We would like to report seperately but I haven’t seen a way to make this happen. Any help would be appreciated. Thanks, Joe 1. Chris Jones says: Could you create two separate accounts for use, one for each datacenter? 1. joe says: I’m not clear on this. What I need to do is to exclude reporting on all of the vms, datastores, and information in one of the two datacenters in vCenter. For example, if I had a prod and a test datacenter and I only wanted to report on prod. When you say two separate accounts do you mean that I would create an account for prod that had no rights to see the test datacenter? If so, wouldn’t that just fail out the script? Thanks for the reply! -Joe 1. Chris Jones says: 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 94. VM-Hiltron says: 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. 95. pedro says: Hi all The script seems to run fine for me, it sends me to my email accout the file with the info, but when i execute the scheduled task it promt me withe the box for user and password, i put a line in 40, but it keep on ask me for the credential any help? Thanks 1. pedro says: 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 96. JD says: 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 97. tot says: is there a way I can save this file rather than emailing? 98. Surya Kiran says: 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 99. --DigDug-- says: Great script. Anyone think of a reason why all my data is doubled up and in some cases, like with datastores, tripled or quadrupled? Thanks 1. Aswini says: 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 100. Skip Hong says: 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. 101. Nathan Hans says: 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. 102. Nathan Hans says: 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.

103. Randy says:

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

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

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

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

Thanks
-Randy-

1. Surya Kiran says:

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

104. Grant says:

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.

1. Grant says:

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

105. Cyril says:

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

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

107. Greg says:

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

108. Erik says:

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

109. Karuna says:

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

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

111. Is there a way to run vCheck without having the security prompt for each plugin file? I have my execution policy set to unrestricted and do not want to set it to bypass. Thanks.

1. set-executionpolicy bypass

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
“Cannot convert the “VimApi_50.ManagedObjectReference” value of type “VimApi_50
.ManagedObjectReference” to type “VimApi_51.ManagedObjectReference”.”
At C:\scripts\vCheck\Plugins\64 Snapshots Oversize.ps1:44 char:71
+ $taskMoRef =$dsb.Client.VimService.SearchDatastoreSubFolders_Ta
sk <<<< ($dsBrowserMoRef,$dir, $searchSpec) + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null. Parameter name: moRef" At C:\scripts\vCheck\Plugins\64 Snapshots Oversize.ps1:45 char:67 +$task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMw are.Vim.VIConvert]::ToVim($taskMoRef)))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

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

and this:

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

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

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

2:24:22 PM ..Sending Email

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

Any ideas?

Thanks

1. Cyril says:

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

2. Cyril says:

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

$searchSpec.details.fileOwnerSpecified =$true

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

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

3. Cyril says:

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. 113. Edward says: 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. 114. JohnB says: @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.

115. Alex says:

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?

116. Todd says:

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!

1. Todd

Where in the 00 Connection Plugin for vCenter do you add it? I cant find it.

117. Todd says:

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

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

119. jconner says:

Alan this script is amazing, thank you for your hard work.

120. Craig Thompson says:

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.

121. Layne says:

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 122. Troy says: 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 123. David Rice says: @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. 124. Ron says: Was wondering if there was something wrong with Plugin 60 – Powered Off VMs.ps1? Doesn’t seem to be generating the correct results. 125. Bryan says: 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\”
}

126. kenny says:

@ 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

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

128. egs says:

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.

129. Dean says:

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.

130. Michael says:

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

131. Tom says:

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

132. Ethan Lowry says:

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?

133. Kevin Leek says:

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?

134. Lukas says:

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.

135. S says:

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

136. All. I have in my settings $DisplaytoScreen =$false but when running the script it is still opening up in IE

Any ideas?

137. wein says:

hello,where i can download v5.1 which have fixed the displaying issue with outlook2007/2010?

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

139. Mike says:

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?

140. Rick says:

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.

141. Natesh says:

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

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

143. Jonathan says:

FYI: The variable $limitSnapshotOversizeShow is not defined. I just add it in “64 Snapshots Oversize.ps1” with a value 120. 144. Kris says: i would luv to an answer file rather waiting for & typing the command. 145. Jones says: I’m stuck after …finished calculating VM CPU %RDY pls help 146. d_ says: 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. 147. Damion S. says: 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? 148. Rick Ziminski says: I have duplicate entries in my report. I must of messed something up. Anyone know what would cause everything to be reported twice? 149. Joe Doe says: 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. 150. Pete L says: 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: 151. ultan lankford says: 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. 152. Jeramey Wentz says: 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 ? 153. steven dillon says: 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 1. Eddie says: Did anyone ever comment or where you able to fix this? I have the same issue! 154. Graham says: 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? 155. Dave says: 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 156. Pat Allen says: @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 157. Dave says: …also just figured out, I got the variables the wrong way round in that code DOH! 158. Dave says: 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… 159. Dave says: @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) { ... ... ...  160. Lance says: 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

161. Larry says:

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

162. Samir says:

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 ?

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

164. Pat Allen says:

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!

165. Samir says:

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

166. Kris says:

instead manual entry, can we automate the process?

167. Sean says:

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

168. Rick says:

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 }

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

170. PaulSaunders says:

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?

171. Sebastian says:

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

172. PaulSaunders says:

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.

173. PaulSaunders says:

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?

174. Amalia says:

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

./vCheck5.ps1 vcenter01
./vCheck5.ps1 vcenter02
..

175. Amalia says:

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?

176. Pat Allen says:

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

177. Dave says:

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

178. Ondrej says:

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.

179. KutuDigital says:

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”

180. razman says:

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

181. l8nighter says:

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 ="[email protected]", "[email protected]" 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. 182. Rick says: 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”. 183. n00b says: 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 …. 184. Andrew says: 185. Ron says: 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 186. Andrew Jones says: 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. 187. Andrew Jones says: I love this Framework! Thanks for creating and posting. I wrote my own weekly plugins for Active Directory (stuff like count of computers by OS, Expired Accounts, Passwords set to never expire,Orphaned Home Dir’s and Profiles, Users/Computers created last 7 days, etc etc etc) using this framework. Alan, I’m more than willing to share what I put together for AD but I’m a novice Powershell scripter at best. My scripting methods probably aren’t the most efficient in terms of execution time and can probably be cleaned up if you are willing. Chad posted about a NetApp vcheck. Is this posted anywhere yet? Also interested in a SQL/WebDev daily script if anyone has started that. 1. Andrew, I have been sent a couple of AD scripts recently, I need to add these to my site, would be great to add yours to them if it covers areas they dont. Hopefully I will add these over the next couple of days. Alan 188. Randy Redekopp says: 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- 189. Michael says: 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. 190. Micheal says: 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. 191. n00b says: 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 ?

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

193. Rob says:

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.

194. Steven says:

Hi Alan,

Any progress on the NetApp-filer plugin?

195. hickwillie says:

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!

196. hickwillie says:

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

197. Joe says:

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?

198. Michael says:

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! 199. Micheal says: It actually finished and has a lot of great info. It took 30 minutes to finish. Great script. 200. Micheal says: 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? 201. Dave says: 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… 202. steven dillon says: 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. 203. Ron says: 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 204. Steven says: Hi Chad, I’m very interested in your script for the NetApp filers! I’ll keep track on Alan whenever he releases them. 205. Chad Killion says: 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. 1. Chad, Awesome! Make sure you send it over to [email protected] 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 😉 206. 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. 207. Seb says: 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. 208. MichaelEA says: 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?

209. Ofer says:

first – let me thank you vCheck – it saved me a lot of work!

i found the plugins xml file on the website is not updated – all links are getting 404

http://www.virtu-al.net/vcheck/plugins/plugins.xml

i believe it should be updated to reflect the correct path.

Ofer

210. Ron says:

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

Thx

211. Ron says:

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 212. Shaun says: 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 213. 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. 1. Greg, You need to schedule it as a Windows Scheduled task, you can then define when it runs and when you receive the email. 214. 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. 215. 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 216. Vman says: Is there a way of running the plugs w/o getting the “do not run/run/suspend” prompt? 217. Martin says: 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. 218. c0de1 says: @alan, unsubscribe is still a pain in the ass… 🙂 This is the management page for following blogs. You will receive an email at [email protected] 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. 219. Ron says: 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 220. michael says: 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. 221. Mark Owen says: Ignore the above one, after reading some of the replies I removed PowerCLI 5 and rebooted and reinstalled which sorted it out. 222. Mark Owen says: 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 223. Sybux says: 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"  224. Kenny says: @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. 🙂 225. Pete says: 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. 226. Pete says: 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 1. Pete, im sorry but the unsubscribe button for the plugin in wordpress doesnt seam to work, im looking into this. 227. Ross Anderson says: . 228. Kenny says: @Alan Any help or guidelines with setting up my suggested hardware change plugin earlier this week? I know all the data is available from vCenter, just need some assistance in bundling it all up in a plugin. Would be greatly appreciated. 🙂 1. Kenny, unfortunately I dont have time to look into that plugin but if you ask on the PowerCLI community you will probably get an answer which you can copy and paste into a plugin, I would start with the Get-ViEvent cmdlet and LucD.info has some great posts on how to use that. 229. Kenny says: @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. 230. Kenny says: @Ben From what I understand, PowerCLI scripts that contain variables and functions should always run in one script. ie If your variables and functions are defined in script1.ps1 and script1.sp1 is run from the cmdlet window and the same variables are called in script2.ps1, then when you try to run script2.ps1 from the cmdlet window, PowerCLI will not recall the variables defined originally from script1.ps1. vCheck.ps1 has reference to all the variables defined in all the scripts. Try the following to resolve your issue. Create a blank script, call it Snapshot.ps1. Edit Snapshot.ps1 and add the function “Write-CustomOut” from the vCheck.ps1 script. This will prevent a pile of errors that will display on your cmdlet window. Under this function, copy each script code in the order Alan mentioned above, first the global script code, then the 00 Connection code, followed by the 02 Snapshot code. Save and close the Snapshot.ps1 script you just created and run it from the cmdlet window. You should get an output, because the variables and functions are defined and referenced in the same script, just like the vCheck.ps1 script is. 1. @Kenny and @Ben, the functions dont need to run in 1 script, just one session, I normally bring it up in PowerGUI Script Editor and run it there so the variables and functions are resident in my session, you can then run each check individually and edit as needed. 231. David says: How do I disable feature: timetorum “This report took ## minutes to run all checks”? Thanks 232. Ron says: 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? 233. Ben says: 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.

234. Ben says:

Hey Alan!

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

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

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

235. Ben says:

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

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

thanks again!

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

236. MS says:

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

237. MS says:

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?

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

238. David says:

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

1. David, looks like i forgot to make use of the $TimeToRun disable.. Doh ! I will make sure this is updated in the next release. 239. Yohan says: 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 🙂 240. Kenny says: 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. 241. c0de1 says: @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 ! 242. c0de1 says: unsubscribe is not an option here i think ?? Can’t unsubscribe here ? I can press “manage your subscripton” but i can’t unsubscribe there, can someone help me with this ? 1. c0de1, sorry about that, I will take a look and see why it isnt working… Was it something we said 😉 243. Yohan Wadia says: I guess what will really be a cool feature to add (after all the testing and finalization is done 🙂 ) is a neat yet simple GUI to run all this.. i guess that will really make this a proper solution rather than just a tool/ utility… something similar to http://www.virtu-al.net/featured-scripts/ha-drs-audit/ 1. Thats not a bad idea, the 00 plugin could actually be written to present a nice GUI, i have also thought about a dynamic GUI for the configuration with an export and import feature but that may take a little time to develop 😉 244. Yohan Wadia says: 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 🙂 245. Phil says: @kenny The initial Exchange 2010 plugins are about to be released. Watch this space 246. kenny says: @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! 247. Phil says: @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 248. l8nighter says: 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 249. Sybux says: 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 !

250. Sybux says:

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

251. Phil says:

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 🙂

252. Phil says:

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.

253. Yohan says:

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

254. Sybux says:

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

255. Sybux says:

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 ?

256. Sybux says:

Release 6.15 :

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

at line 92, it should be :

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

with a capital S at ServiceInstance.

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

257. —- 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. 258. 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) 1. Thanks Robert, updated for next release. 259. james says: 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 260. james says: 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. 261. Phil says: 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 262. 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 263. Shane says: That is what I said, the Powered off VM’s took 21 minutes This report took 39.48 minutes to run all checks. The following plugins took longer than 30 seconds to run, there may be a way to optimize these or remove them if not needed 01 General Information.ps1 51.77 02 Snapshot Information.ps1 37.51 27 VM Tools Issues.ps1 73.51 32 VM CPU Percent RDY.ps1 134.83 33 VM CPU Usage.ps1 299.53 48 FindVmDiskFormat.ps1 74.28 60 Powered Off VMs.ps1 1275.58 63 Snapshot removed.ps1 59.26 65 Snapshot created.ps1 51.27 71 Capacity Planning.ps1 80.08 1. Shane, Ahh yeah, I see. So if its an issue and you are not really interested in when VMs were Powered Off then I would remove that file from the plugins folder, thats the great thing about this script ! That particular script does take a while gathering the events and sorting them out to find out when it was powered off. 264. @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.

265. Shane says:

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

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

266. james says:

One thing I do see now is this though:

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

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

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

267. Phil says:

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.

268. Sybux says:

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

269. 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 270. james says: 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 1. No probs James, that will teach you to use an existing name 😉 271. Phil says: James, Try upgrading to PowerCLI 5.0.1 272. james says: 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

273. Brian says:

how can i unsubscribe here ?

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

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

274. Pingback: vCheck 6.10 update
275. james says:

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

1. James, what version of PowerShell are you using ? I haven’t seen this anywhere else ?

276. RobVM says:

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.

277. ———– vCheck 6.10 Released ———–

278. Owen says:

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! 279. Antonio says: 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!! 280. Yohan Wadia says: 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… 🙂 281. Brian says: 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? 282. Shane says: 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? 283. l8nighter says: 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) + “%”}

}

284. Howard says:

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?

285. Doug B says:

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.

286. Shane says:

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.

287. Michael Zappa says:

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

288. JT says:

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

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

289. ultan says:

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

290. Steve Gold says:

Alan, thank you for all your great work on providing this script.

291. Jon T says:

There also seems to be an issue with the HWversion plugin: $_.hwversion doesn’t seem to be a valid use of the property. 1. Thanks for all the comments I have fixed most of these issues in the next version which I will upload soon. 292. Jon T says: 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 293. bapt1979 says: I’im using vCheck V6 294. bapt1979 says: 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 295. ultan says: 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?

296. jaco says:

297. supal says:

Awesome! great work, Alan! you make VI admins life easier.

298. John says:

Is there a way to publish this report directly to a SharePoint site?

299. Steve Gold says:

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

300. Steve Gold says:

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

Any thought?

301. c0de1 says:

Alan,

how can i unsubscribe here ?

302. Eelco says:

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

303. rob moore says:

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 304. John Sam says: 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. 305. Phil says: @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.

306. tom miller says:

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

307. SomeITGuy says:

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 308. Ryan PIghin says: 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? 309. Jeramey says: I want to add the ability to specify which data centers the script will check. Any suggestions would be great… 310. Phil says: 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. 311. Kev says: Does anyone know why none of the counts and only some of the variables display in the HTML report? 312. Steve says: 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. 313. Steve says: 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. 314. kenny says: @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… 🙂 315. Phil says: @kenny, I’d be interested to know what info people would want to get out of Exchange 2010. So far, I’ve just hacked a couple of scripts I already had because I could 🙂 My proof-of-concept script listed Exchange 2010 databases, their sizes, amount of whitespace, number of mailboxes, average mailbox size, etc I’ve also got one showing replication statuses of DBs. 1. Phil, Making the changes right now, thanks. Also some of the ones you and others have emailed me. The Exchange one is Awesome, exactly what I wanted people to do. Soon we will have an army of vChecks ! 316. kenny says: @phil, @alan, How is the vcheck + the exchange 2010 sample plugin coming along? I definitely want that! 317. SomeITGuy says: @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

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

318. Mark says:

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

319. Phil says:

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) 320. Phil says: 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 321. Phil says: 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. 322. Phil says: 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. 1. Phil, Awesome stuff – keep it coming ! 323. Francois says: @Robert Thanks. That makes it a lot easier. 324. Francois says: 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.

1. Francois, Thanks, I will loog at this.

325. @Francois If you unblock the vCheck.zip file before you unpack it, then you don’t have to unblock all the individual files.

326. Francois says:

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.

1. Francois, Thanks for this information.

327. Sybux says:

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

1. Sybux, I guess so. Thanks for letting me know.

328. Michael says:

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”

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

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

1. Michael,

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

329. SomeITGuy says:

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.

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

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

330. Phil says:

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

331. Sybux says:

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 ?

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

333. Is there a recommended way to disable a plugin without removing it from the plugins folder? If I rename one of these files to .PS1-DONTRUN it doesn’t run it. But it runs the one above twice. 🙁

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

334. billywestbury says:

Hi Alan

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

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

Thanks again.

Billy

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

335. Sybux says:

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:11 Collecting VM Objects
09:36:12 Collecting VM Host Objects
09:36:15 Collecting Cluster Objects
09:36:16 Collecting Datastore Objects
09:36:16 Collecting Detailed VM Objects
09:36:21 Collecting Template Objects
09:36:22 Collecting Detailed VI Objects
09:36:22 Collecting Detailed Alarm Objects
Get-View : Cannot validate argument on parameter 'VIObject'. The argument is nu
ll or empty. Supply an argument that is not null or empty and then try the comm
and again.
At C:\Users\$heginfo\Desktop\vCheck6\GlobalVariables.ps1:85 char:21 +$alarmMgr = get-view <<<< $serviceInstance.Content.alarmManager + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingVal idationException + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom ation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView 09:36:22 Collecting Detailed VMHost Objects 09:36:31 Collecting Detailed Cluster Objects 09:36:31 Collecting Detailed Datastore Objects 09:36:32 ..finished calculating General Information by Alan Renouf v1.0 09:36:35 ..finished calculating Snapshot Information by Alan Renouf v1.0 09:36:36 ..finished calculating Datastore Information by Alan Renouf v1.0 09:36:36 ..finished calculating Map disk region event by Alan Renouf v1.0 09:36:36 ..finished calculating Hosts in Maintenance Mode by Alan Renouf v1.0 09:36:36 ..finished calculating Hosts Not responding or Disconnected by Alan Ren ouf v1.0 09:36:40 ..finished calculating Hosts Overcommit state by Alan Renouf v1.0 09:36:53 ..finished calculating Hosts Dead Lun Path by Alan Renouf v1.0 09:37:07 ..finished calculating Created or cloned VMs by Alan Renouf v1.0 09:37:08 ..finished calculating Removed VMs by Alan Renouf v1.0 09:37:09 ..finished calculating VMs with over x vCPUs by Alan Renouf v1.0 09:38:41 ..finished calculating VMs Ballooning or Swapping by Alan Renouf v1.0 09:38:41 ..finished calculating Invalid or inaccessible VM by Alan Renouf v1.0 09:38:56 ..finished calculating VMs restarted due to Guest OS Error by Alan Reno uf v1.0 09:39:04 ..finished calculating HA VMs restarted by Alan Renouf v1.0 09:39:04 ..finished calculating Host Swapfile datastores by Alan Renouf v1.0 09:39:05 ..finished calculating DRS Migrations by Alan Renouf v1.0 09:39:05 ..finished calculating Cluster Slot Sizes by Alan Renouf v1.0 09:39:06 ..finished calculating Guests with less than x MB by Alan Renouf v1.0 09:39:07 ..finished calculating ESXi with Technical Support mode or ESXi Shell e nabled by Alan Renouf v1.0 09:39:20 ..finished calculating ESXi hosts which do not have Lockdown mode enabl ed by Alan Renouf v1.0 09:39:20 ..finished calculating Checking VM Hardware Version by Alan Renouf v1.0 09:39:20 ..finished calculating Checking VI Events by Alan Renouf v1.0 09:39:21 ..finished calculating Checking Standard vSwitch Ports Free by Alan Ren ouf v1.0 09:39:21 ..finished calculating VMs in inconsistent folders by Alan Renouf v1.0 09:39:21 ..finished calculating No VM Tools by Alan Renouf v1.0 09:39:32 ..finished calculating VM Tools Issues by Alan Renouf v1.0 09:39:36 ..finished calculating CD-Roms Connected by Alan Renouf v1.0 09:39:40 ..finished calculating Floppys Connected by Alan Renouf v1.0 09:39:41 ..finished calculating Single Storage VMs by Alan Renouf v1.0 09:39:42 ..finished calculating NTP Name and Service by Alan Renouf v1.0 09:39:43 ..finished calculating VM CPU %RDY by Alan Renouf v1.0 09:39:45 ..finished calculating VM CPU Usage by Alan Renouf v1.0 09:39:48 ..finished calculating Number of VMs per Datastore by Alan Renouf v1.0 09:39:48 ..finished calculating Host Configuration Issues by Alan Renouf v1.0 You cannot call a method on a null-valued expression. At C:\Users\$heginfo\Desktop\vCheck6\Plugins\36 Host Alarms.ps1:11 char:29
+ $alarms =$alarmMgr.GetAlarm <<<< ($null) + CategoryInfo : InvalidOperation: (GetAlarm:String) [], RuntimeE xception + FullyQualifiedErrorId : InvokeMethodOnNull 09:39:48 ..finished calculating Host Alarms by Alan Renouf v1.0 09:39:48 ..finished calculating VM Alarms by Alan Renouf v1.0 09:39:48 ..finished calculating Cluster Configuration Issues by Alan Renouf v1.0 09:39:48 ..finished calculating Datastore OverAllocation by Alan Renouf v1.0 09:39:48 ..finished calculating VCB/Veeam Garbage by Alan Renouf v1.0 09:39:50 ..finished calculating VC Services by Alan Renouf v1.0 09:39:59 ..finished calculating Windows vCenter Error Event Logs by Alan Renouf v1.0 09:40:02 ..finished calculating Windows vCenter Warning Event Logs by Alan Renou f v1.0 09:40:22 ..finished calculating VMKernel Warnings by Alan Renouf v1.0 09:40:22 ..finished calculating VMs needing snapshot consolidation by Luc Dekens v1.0 09:40:22 ..finished calculating Missing ESX(i) updates and patches by Luc Dekens v1.1 09:40:22 ..Displaying HTML results I don't know if it's "good" or "bad" but just in case. Of course if you need help to test again, no problem, I'm here. One other thing, in the report, I get some message in french (which is the language I use), but I'd like to know if it's possible to force to english which is always more understanding 🙂 Thanks you for your really nice and usefull script. 1. Sybux, This looks like an error with the initial connection somehow, did you alter the script manually or just follow the wizard and enter the IP/Hostname of your VIServer ? 336. james says: If i hardcode the paths it seems to run, other than that I see errors re: the path 1. Can you let me know what the errors are please so I can make sure others dont get this. Thanks 337. RobVM says: 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. 338. RobVM says: Alan, Yes, I ran that script on the c:\vCheck6 folder, it signs all the scripts in the vCheck6 folder and the plugins subfolder as well. Thanks for the tip. Note the script needs to have the path changed in two spots. -Rob 1. Good to know, thanks. Now run the script with -config and change something in the wizard, I bet it breaks! You will probably have to sign it only after running through the wizard. 339. cookies says: New version: Get the error: The term ‘Get-Compliance’ is not recognized as the name of a cmdlet…. Any ideas? 1. Thanks, this check uses the VMware Update Manager Snapin for PowerShell which is a separate install to PowerCLI, I have updated the plugin to check for this snapin first. If you dont need that then please delete the check from the plugins folder, if you do want it then please download the VMware Update manager snapin from here: http://www.vmware.com/support/developer/ps-libs/vumps/ Make sure you download the correct version depending on your Update manager Version, the Update Manager snapin is not backward compatible. 340. RobVM says: 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 341. —– VCHECK 6 RELEASED —– 342. Kim says: 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. 343. Sai Garimella says: Thanks for the excellent script — is there a way to pull annotations from the hosts which are in maintenance mode? 344. Fred says: at vSwitch Ports Check section my report is showing all my dvSwitches and at column “ports left” there are no values. 1. Fred, Yes the dvSwitches dont have that property, I have changed this check in v6 to only look at standard groups, maybe another check will do the work for dvSwitches. 345. Fred says: 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”}

346. Fred Witteman says:

I have 2 ntp servers:
10.10.10.80
and
10.10.10.85
How should i define the $ntpserver ? 1. Fred use “10.10.10.80|10.10.10.85” 347. Morrisos says: All charts are blank. Other info seems to be there. Any idea why charts are blank? I am using Office 2010. Thanks, Morrisos 348. James B. says: 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? 349. tulk says: 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 350. Ryan PIghin says: 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 351. Luis says: 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 = “[email protected]; [email protected]

Thank you

352. Martin says:

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.

353. kenny says:

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?

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

355. Yohan says:

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

356. Yohan says:

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

cant wait for more

357. bd says:

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?

358. Jinendra says:

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

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

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

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

362. Mobashar says:

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.

363. Nick says:

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.

364. lukessi says:

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?

365. lukessi says:

Does this work fine on ESXi 5 vcenter.

As I could do with this?

Cheers

Luke

1. Luke,

Yep should do, works fine on mine. Let me know if you hit any issues.

366. slaclair says:

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 [email protected] 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

1. Thanks, I know about the warnings, need to fix that in a future version.

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

368. Chilloutfaktor says:

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>

1. Thanks for the timings, this is useful when looking at areas to optimize for future versions.

369. Mike R says:

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!

370. J Bell says:

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.

371. rob says:

great script.
Would love to see a check on objects that have alarm actions disabled.

372. Pete L says:

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?

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

374. c0de1 says:

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.

375. Todd says:

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.

376. tranquilo says:

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

377. Mogens says:

Hey Dan D (August 23, 2011)

super schedule setup, Thanks 🙂

378. tof says:

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!

379. Brian Larsen says:

Hi

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

380. Mogens says:

It’s running 🙂

381. Mogens says:

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.

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

383. ChrisSB says:

Hi All,

Running Version 5.0

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 384. Firestarter says: 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 385. Jithu says: 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? 386. Blade says: 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. 387. cscol says: 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. 388. c0de1 says: 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 ? 389. tranquilo says: 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

390. Andy says:

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?

1. It is PowerCLI 5.0 you need, what are the errors you are getting ?

391. Sandeep says:

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

1. No, I dont write SQL scripts.

392. Kenny says:

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.

1. The download should now be re-available again – sorry for the delay,

393. jkavanagh58 says:

1. Still working on restoring my site after a hack.

394. Srinivas says:

Not able to get the Linux VM’s server information

395. Simon Tam says:

Excuse me, I got a found not found error. Is the script still available?

396. Chris says:

Seems the download isn’t working. I would love to try the script out though 🙂

397. Kenny says:

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?

398. Corey says:

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?

399. @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 “[email protected]” -To “[email protected]” -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.

400. Roy B says:

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

401. Jaap says:

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(“[email protected]”, “xxxxxxxx”);$msg.IsBodyHTML = $true$mailer.send($msg) } # Set the SMTP Server address$SMTPSRV = “xxxx.xxx.xxx”
# Set the Email address to recieve from
$EmailFrom = “[email protected] # Set the Email address to send the email to$EmailTo = “[email protected]

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

Regards

Jaap

402. c0de1 says:

@bwuch

Nevermind i found it 🙂

403. c0de1 says:

@bwuch

Nice, thanks, but how can i say where the file must go ?

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

405. c0de1 says:

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?

406. Jinendra says:

can u add vmkuptime.pl report in the vchek

407. Dan D says:

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:

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!

408. Harry Reed says:

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 409. Kenny says: @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. 410. @Kenny, you can get the VM name also with: Get-VM | Get-NetworkAdapter | Select-Object -Property @{N=”VM”;E={$_.Parent}},

411. moehp says:

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!

412. Kenny says:

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?