Here I am going to show you how to install and configure the vSphere HCR v.5 on the Windows platform. There are a few tools you need before we get started. Go ahead and download them so you will be ready to implement them when the time is ready.
PowerCLI , Powershell , Report.txt, VMware-vSphere-Perl-SDK
vSphere Health Check Report – Please make sure you have the latest copy
*Note* I am going to be installing the version compatible with vSphere and above. If you are currently running ESX(i) 3.5 with update 2 or above, please use VMware Health Check Report v0.9.5
Since vCenter is currently only installable on a Windows platform, this is where I chose to run these scripts from. From here, you can set Task Manager to email you the report on demand. Make sure both Microsoft Powershell (2003 version) and Power CLI on the vCenter server.
If you haven’t done so, go to http://communities.vmware.com/docs/DOC-9842 to download the the latest Health Check script found right before the comments area. Next, create a scripts folder under the C: drive to put the file(s) in.
Extract the contents with any compression executable and place the two files in the scripts folder.
There is no need to edit the heathcheck.conf file since the report.ps1 will automate the email process. Take the downloaded file called Report.txt and stick it in the scripts folder. Rename the the file’s extension to “.ps1”. This will make it readable by PowerCLI.
When you edit the file it will look like the format below.
$dt = get-date -format yyyyMMdd
C:\scripts\vmwarevSphereHealthCheck.pl –server vCenterServerName –username administrator –password localadminpass –type datacenter –datacenter “DataCenterName” –report C:\scripts\vmware_health_check$dt.html -email yes
$pp = get-process perl
$pp.waitforexit()
$file = “C:\scripts\vmware_health_check$dt.html”
$smtpServer = “YourEmailServerName”
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($file)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “vmwarereport@yourcompany.com”
$msg.To.Add(“youremailaddresses”)
$msg.Subject = “Today’s VMWare Health Report”
$msg.Body = “Enjoy from myvmland.com!”
$msg.Attachments.Add($att)
$smtp.Send($msg)
$att.Dispose()
Remove-Item C:\scripts\vmware_health_check$dt.html
– Edit the information in BOLD so that it matches your organization. I recommend user a user’s password that does not change. Exit the editor and be sure to save the changes.
Now, let’s test the script to make sure there are no error. Open up vSphere PowerCLI – Then browse to the scripts directory and execute the script.
If all goes well, you will have a message from the scripts creator (William Lam) telling you to get a cup of coffee/tea and check out his website. This can take a while, as mine took over 5 minutes to finally email me.
The next step is to set windows to auto run the script so you don’t have to manage that. Anything that helps automate this process so you can just stick to watching your environment.
Open up Scheduled Tasked under the Start Menu and create a new task by clicking “Add Scheduled Task”. Browse your Applications till you find VMware vSphere Power CLI and click next. Choose the method of time frame and click next. From there you need to enter a user name and password that will not be changing. I would suggest using the local administrator account. Finish and open up the advanced settings for this task. Copy and paste the below information
Insert this into the Run: “C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ ” & “C:\Scripts\report.ps1″
Click the apply and give it a test run. That should be all the modifications you will need to finish the automation. Please let me know if this information has been helpful or needs any updates.
If you have any problems running the script then open up PowerCLI from the Start Menu Programs. Browse to the scripts folder and test to make sure its working with this command:
./ vmwarevSphereHealthCheck.pl –server vCenterServerName –username administrator –password localadminpass –type datacenter –datacenter “DataCenterName” –report C:\scripts\vmware_health_check$dt.html
Please leave some feedback on anything you would like to see or added to this post.
Can you verify for me that you have PowerCLI installed along with Powershell 1.0. Sounds like the PowerCLI may be the issue. As a way to troubleshoot, try this on any windows machine. Maybe throw up a test VM to try it on a clean install of Windows. Please update me with the status of this issue.
Thanks,
Wes
That is the same environment that I have it currently running in. I would try backtracking to see how far back I needed to go so I can run the script. Open up PowerCLI and try running the vmwarehealthcheck.pl manually from the /scripts folder.
C:\scripts\vmwarevSphereHealthCheck.pl –server vCenterServerName –username administrator –password localadminpass –type datacenter –datacenter “DataCenterName” -report. This should insert the html file within the scripts folder locally. Can you get that to work or do you get the same error?
Also, did you make sure you have the latest version of PowerCLI? 4.0 U1
Hello
for me il’s unable to run with vmlist option
it OK with datacenter option but result don’t show any VM in last VM tab
thanks for your help
Eric
Hello,
Every time i run the script i get the following error. I do however recieve an email. It looks like it is just having an issue creating the html. Can you give me some insight into this?
New-Object : Exception calling “.ctor” with “1” argument(s): “Could not find fi
le ‘C:\scripts\vmware_health_check20100526.html’.”
At C:\Users\username\AppData\Local\Temp\2\2590cec9-6178-4148-9bc2-f9e071c4bd8e.p
s1:8 char:18
+ $att = new-object <<<< Net.Mail.Attachment($file)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
Exception calling "Add" with "1" argument(s): "Value cannot be null.
Parameter name: item"
At C:\Users\username\AppData\Local\Temp\2\2590cec9-6178-4148-9bc2-f9e071c4bd8e.p
s1:14 char:21
+ $msg.Attachments.Add <<<< ($att)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\Users\username\AppData\Local\Temp\2\2590cec9-6178-4148-9bc2-f9e071c4bd8e.p
s1:16 char:13
+ $att.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeEx
ception
+ FullyQualifiedErrorId : InvokeMethodOnNull
Remove-Item : Cannot find path 'C:\scripts\vmware_health_check20100526.html' be
cause it does not exist.
At C:\Users\username\AppData\Local\Temp\2\2590cec9-6178-4148-9bc2-f9e071c4bd8e.p
s1:17 char:12
+ Remove-Item <<<< C:\scripts\vmware_health_check$dt.html
+ CategoryInfo : ObjectNotFound: (C:\scripts\vmwa…ck20100526.ht
ml:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
Well, it looks like it is never creating the HTML file. I had a very similar issue when I was creating this guide. My issues was I didn’t have something correct in the Datacenter name. I don’t know if this is your issue, but try running the command with PowerCLI.
Open up PowerCLI from the Start – Menu – Programs in windows. Once open, run this command:
C:\scripts\vmwarevSphereHealthCheck.pl –server vCenterServerName –username administrator –password localadminpass –type datacenter –datacenter “DataCenterName” –report C:\scripts
Replace each one of them with your server/user information. If you get an error here, then there is a typo/permissions/wrong name in one of these areas.
Please keep me posted as I like to hear feedback.
Thanks,
Wes
I am starting to lean towards the permission issue, When I run it from PowerCLI as you stated above I get no error message. It seems to go through. Although I dont get any information returned,
Now I do believe the html is the part having issues. When I create an html doc labled the following for example vmware_health_check20100528.html it will run without any errors. I get the html doc sent to me in an email, although it does not have any data. I have checked everything for typo’s over and over and do not see any.
Does this need to run on the actual vCenter box? I have tried it on our vc machine as well as a vm running vMware Update Manager. Both return the exact same error.
Also does it need to be a local admin account or will a domain admin account work as well?
My current structure is this, if it helps, all machines in question are running on esx 4 hosts ( have not updated to esx 4 update 1 yet ). The vSphere server and the Vum machine are both win2k8 enterprise edition.
If it works then you will get a message saying to sit back and enjoy a cup of coffee. So if you are not getting that then it isn’t working.
Make sure you are running this command from the PowerCLI icon that looks like the picture at the top of this blog. Otherwise it will just look like a regular command box (no colors) and not work.
It can actually run on any windows servers that has PowerCLI installed under different usernames. I would just want to make sure it was admin of vCenter.
Getting the same error described by elisiens in #7
So I started googlin for how to keep the perl window open when called from PowerShell…clearly I am in over my head here…but I found this:
http://www.perlmonks.org/?node_id=786573
which suggested prefacing you command with “perl ”
So I changed line two of report.ps1 to be:
perl E:\vSphereHCR\vmwarevSphereHealthCheck.pl…
Now I can see that my error is:
PS E:\vSphereHCR> ./report.ps1
Generating VMware vSphere Health Report 4.0.7 “E:\vSphereHCR\vmware_health_check
20100602.html” …
This can take a few minutes depending on environment size.
Get a cup of coffee/tea and check out http://www.engineering.ucsb.edu/~duonglt/v
mware/
Can’t locate object method “licenses” via package “LicenseManager” at E:\vSphere
HCR\vmwarevSphereHealthCheck.pl line 350.
End Disconnect
OK starting from my previous post:
I went to line 350 which is part of a subroutine called by line 168 so I set it to “no”. (my $SYSTEM_LICENSE=”no”;)
Then I got a similar error from line 486 which is part of a subroutine called by line 173 so I set it to “no”. (my $SYSTEM_PLUGIN=”no”;)
Then I got an error from line 3147
Can’t locate object method “vmMonitoring” via package “ClusterDasConfigInfo” at
E:\vSphereHCR\vmwarevSphereHealthCheck.pl line 3147.
I could not figure out what to do about that.
I am now getting some output in the email though.
It seems like I am just having trouble with a couple modules. Which makes me think it is some sort of compatibility / version issue between vSphere and CLI and the script and ??? But I am already beyond my limit of troubleshooting PS and Perl.
Would love to get this script running.
Are all of your hosts and vCenter running ESX 4 and above? I was looking at a similar problem on http://communities.vmware.com/docs/DOC-9842.
I really don’t think this is related to perl.
Thanks,
Wes
ESXi and vCenter are both most recent builds of 4. I double checked that CLI is 4.1
I know all of my ESX hosts are version 4, not update 1. I got the report running via the vMA appliance with all of the same credentials. I will play around with some of the things posted by Mike above and see what I find. Will let you know tomorrow how it goes.
Question when the .pl script runs what program is supposed to be calling this?
Got it working, I had an issue with vmware sdk install. I re-installed the program and walla the script ran. I did have to place perl at the begining of line 2 as Mike posted abaove. Thanks for your help, and the wonderful script.
Hi, thanks for taking the time to show others how to get this working on Windows! I have a problem though and was wondering if you could help. After the bit about getting a coffee i get the following message:
Can’t locate object method “vStorageSupport” via package “HostScsiDisk” at C:\…\vmwarevSphereHealthCheck.pl line 2458
Any ideas how to fix?
Thanks
Simon
After reviewing this I noticed that he has updated his script. In which case someone else had also made the same comment. It looks like you need to be at the latest vSphere 4.1 release in order for this to run correctly. I was asked by William (script author) not to link to older versions of the script. Let me know if this is still an issue with your environment.
Hi, I am having problems getting this working too. I just installed the latest Powershell v2, VMware vSphere Power CLI, ActivePerl and the script on the vcenter VM – Windows Server 2008 R2 x64.
It comes up with the following error message:
New-Object : Exception calling “.ctor” with “1” argument(s): “Could not find fi
le ‘C:\scripts\vmware_health_check20100720.html’.”
At C:\scripts\report.ps1:8 char:18
+ $att = new-object <<<< Net.Mail.Attachment($file)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
Exception calling "Add" with "1" argument(s): "Value cannot be null.
Parameter name: item"
At C:\scripts\report.ps1:14 char:21
+ $msg.Attachments.Add <<<< ($att)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\scripts\report.ps1:16 char:13
+ $att.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeEx
ception
+ FullyQualifiedErrorId : InvokeMethodOnNull
Remove-Item : Cannot find path 'C:\scripts\vmware_health_check20100720.html' be
cause it does not exist.
At C:\scripts\report.ps1:17 char:12
+ Remove-Item <<<< C:\scripts\vmware_health_check$dt.html
+ CategoryInfo : ObjectNotFound: (C:\scripts\vmwa…ck20100720.ht
ml:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
eItemCommand
Any help appreciated
I was able to reproduce this by installing ActivePerl. How I fixed the issue was to uninstall it and install the vSphere SDK for Perl. Next I ran a test by opening up either version of PowerCLI (32bit or regular). After making sure the scripts was in C:\scripts folder I ran “C:\scripts\hcr.pl –server vCenterServerName –username administrator –password ******** –type datacenter –datacenter “Work Operations” –report C:\scripts\vm.html. Notice I did rename the script to hcr.pl. The script ran fine and I was able to view the report after that. Then I just setup report to run in automation. Please keep me posted if you continue to have this problem.
Thanks,
Wes
Hi Wes,
Fantastic – once i unstalled ActivePerl and nstalled the VMware Perl SDK this resolved my issues.
Thanks,
Doug
Hey Doug,
I was able to get this working as well. Here is the setup I have.
My task scheduler just runs the report.ps1 script.ps1 directly. I just make sure my report.ps1 file opens with powershell by default. Just right click the report.ps1, and change the “Opens with:” to powershell which is located at (%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe).
Now, I never had a problem getting it to mail to me so there could be another problem other than scheduler. However, if you run it the same was as I just wrote then you may not have that issue. Keep me posted as I would like to know the answer.
Thanks,
Wes
im pretty sure the script runs for me, however the email has no attachment. When i try and run it manually, i get this error >
Program ‘vmwarevSphereHealthCheck.pl’ failed to execute: Application not found
At line:1 char:30
Very nice little script this. I have commented out the mail part and the delete HTML portion of the script and got it to point to vcenter instead as I want it for occasional use only, but still works a treat.
Good effort /
where do i download the actual HCR application?
Out of respect for the writer of the script, I did not link directly to it. Please search the page http://communities.vmware.com/docs/DOC-9842 for “vmwarevSphereHealthCheck.tar.gz” which is the file name of the HCR.
Andy, are you changing the report.txt(ps1) to the E: drive as associated with your error? I set it up to run in C:\scripts so make sure you have changed your paths as well.
Also, when you are running the script. Be sure that it creates a vmware_health_check$dt.html while working. Or you can remove the “Remove-Item C:\scripts\vmware_health_check$dt.html” from the powershell script to make sure it does not delete it.
Andy,
Thanks for stopping by and let me know when you get the vMA cron job scheduled. I am hoping to get an article that will help others build that. Any helpful information will be appreciated by all.
Thanks again,
Wes
Hi
when I try to run the “Report.ps1” script in vSphere PowerCLI, I would get the immediate popup of “vmwarevSphereHealthCheck.pl” notepad and the following errors as shown below. Please help!
[vSphere PowerCLI] C:\Scripts> .\Report.ps1
Get-Process : Cannot find a process with the name “perl”. Verify the process name and call the cmdlet again.
At C:\Scripts\Report.ps1:3 char:18
+ $pp = get-process <<<< perl
+ CategoryInfo : ObjectNotFound: (perl:String) [Get-Process], ProcessCommandException
+ FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommand
You cannot call a method on a null-valued expression.
At C:\Scripts\Report.ps1:4 char:16
+ $pp.waitforexit <<<< ()
+ CategoryInfo : InvalidOperation: (waitforexit:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
New-Object : Exception calling ".ctor" with "1" argument(s): "Could not find file 'C:\scripts\vmware_health_check20110208.html
At C:\Scripts\Report.ps1:8 char:18
+ $att = new-object <<<< Net.Mail.Attachment($file)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
Exception calling "Add" with "1" argument(s): "Value cannot be null.
Parameter name: item"
At C:\Scripts\Report.ps1:14 char:21
+ $msg.Attachments.Add <<<< ($att)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\Scripts\Report.ps1:16 char:13
+ $att.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Remove-Item : Cannot find path 'C:\scripts\vmware_health_check20110208.html' because it does not exist.
At C:\Scripts\Report.ps1:17 char:12
+ Remove-Item <<<
Can you try to remove this line from report.ps1 “Remove-Item C:\scripts\vmware_health_check$dt.html“. This should leave the report in the scripts directory without emailing it to you. Let me know if it produces the results.
Thanks,
Wes
Try running the “.\vmwarevSphereHealthCheck.pl –server miserver –username administrator –password xxxxxxx –type datacenter –datacenter “corp” –report C:\scripts\vmware_health_check.html –email no” options from the C:\scripts directly itself from PowerCLI.
If you are having a problem there, then you will need to look at possible machine issues or username/password inconsistencies.
Also, your environment may be very large. Try just doing a few hosts by using this command: “./vmwarevSphereHealthCheck.pl –server VC_SERVER –username VC_USERNAME –password VC_PASSWORD –type vcenter –hostlist hostlist”
This will take less time to run because it will just run per server instead of datacenter level.
-Wes
Thank you! I appreciate any and all feedback.
At this point, this almost sounds like a permissions error due to the limitations. Can you browse the datastores with the username and password you are giving the script? I have not heard of this particular issue before. Are all of your ESX hosts on the same version or is some different? Would love to hear the outcome of this issue.
Thanks,
Wes
whn i try to xecute scripts
its asks me for password???? what password is it asking for
i am not using vcenter i just want to get health report for my free ESXi host
the report.ps1 for me looks like this
$dt = get-date -format yyyyMMdd
perl C:\scripts\vmwarevSphereHealthCheck.pl –server 192.168.X.X –username root–password XXXXXX –type host –report C:\scripts\vmware_health_check$dt.html -email yes
$pp = get-process perl
$pp.waitforexit()
$file = “C:\scripts\vmware_health_check$dt.html”
$smtpServer =”mail.XXXX.com”
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($file)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “[email protected]”
$msg.To.Add(“[email protected]”)
$msg.Subject = “Today’s VMWare Health Report”
$msg.Body = “Enjoy from myvmland.com!”
$msg.Attachments.Add($att)
$smtp.Send($msg)
$att.Dispose()
THE ERROR THAT I GET IS:::::::
[vSphere PowerCLI] C:\scripts> .\Report.ps1
Enter password:
Error: Cannot complete login due to an incorrect user name or password.
Get-Process : Cannot find a process with the name “perl”. Verify the process na
me and call the cmdlet again.
At C:\scripts\Report.ps1:3 char:18
+ $pp = get-process <<<< perl
+ CategoryInfo : ObjectNotFound: (perl:String) [Get-Process], Pro
cessCommandException
+ FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.
Commands.GetProcessCommand
You cannot call a method on a null-valued expression.
At C:\scripts\Report.ps1:4 char:16
+ $pp.waitforexit <<<< ()
+ CategoryInfo : InvalidOperation: (waitforexit:String) [], Runti
meException
+ FullyQualifiedErrorId : InvokeMethodOnNull
New-Object : Exception calling ".ctor" with "1" argument(s): "Could not find fi
le 'C:\scripts\vmware_health_check20110417.html'."
At C:\scripts\Report.ps1:8 char:18
+ $att = new-object <<<< Net.Mail.Attachment($file)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
Exception calling "Add" with "1" argument(s): "Value cannot be null.
Parameter name: item"
At C:\scripts\Report.ps1:14 char:21
+ $msg.Attachments.Add <<<< ($att)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\scripts\Report.ps1:16 char:13
+ $att.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeEx
ception
+ FullyQualifiedErrorId : InvokeMethodOnNull
Prateek,
In your case then you should be using “./vmwarevSphereHealthCheck.pl –server ESX_ESXi_SERVER –username ESX_ESXi_USERNAME –password ESX_ESXi_PASSWORD –type host” in your vMA.
That would coincide with William’s documentation of the script commands. Please review his article if you have not as I built this step by step procedure on top of his document.
Hi everyone…
I have implemented this script on a cluster of three nodes, and in the part of “ESX / ESXi Hardware Health Status” in the row “Battery 0 on Controller Charging …” Status: UNKNOWN” that reports on two of the 3 host. But if you review the vSphere console display correctly in the three host.
any idea why?
Can you actually see this in Virtual Infrastructure on the Status of the hardware?
In vmware infrastructure vSphere client I see it correctly. Batery: OK
So I’m able to get the script to run, but it is asking for a username and password even though it is supplied in the command. Seen this before?
Hi Wes,
if the rung the following command “C:\scripts\vmwarevSphereHealthCheck.pl –-server VC_Name –-username USERNAME –-password PASSWORD –-type datacenter -–datacenter “TEST” –-report C:\scripts\vmware_health_check$dt.html” from vSphere CLI it works. But I’m getting the below error while running report.ps1.
[vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI
> C:\Scripts\Report.ps1
New-Object : Exception calling “.ctor” with “1” argument(s): “Could not find fi
le ‘C:\scripts\vmware_health_check20110908.html’.”
At C:\Scripts\Report.ps1:8 char:18
+ $att = new-object <<<< Net.Mail.Attachment($file)
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
tionException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
Shell.Commands.NewObjectCommand
Exception calling "Add" with "1" argument(s): "Value cannot be null.
Parameter name: item"
At C:\Scripts\Report.ps1:14 char:21
+ $msg.Attachments.Add <<<< ($att)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Exception calling "Send" with "1" argument(s): "Mailbox unavailable. The server
response was: 5.7.1 … Relaying denied. IP name lookup faile
d [10.100.25.12]”
At C:\Scripts\Report.ps1:15 char:11
+ $smtp.Send <<<< ($msg)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\Scripts\Report.ps1:16 char:13
+ $att.Dispose <<<< ()
+ CategoryInfo : InvalidOperation: (Dispose:String) [], RuntimeEx
ception
+ FullyQualifiedErrorId : InvokeMethodOnNull
Remove-Item : Cannot find path 'C:\scripts\vmware_health_check20110908.html' be
cause it does not exist.
At C:\Scripts\Report.ps1:17 char:12
+ Remove-Item <<<< C:\scripts\vmware_health_check$dt.html
+ CategoryInfo : ObjectNotFound: (C:\scripts\vmwa…ck20110908.ht
ml:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov
eItemCommand
Do i have to uninstall it and install the vSphere SDK for Perl in order to fix this issue?
Br,
Kris
Jay, were you able to get this resolved? I can safely say I have never seen this unless the password is wrong or not associated with the user.
Thanks,
Wes
I usually run this on healthcheck on my local machine which uses Outlook or any other mail client. Are you running it on a server by chance that does not have relaying on? Just trying to determine why it has this syntax “Relaying denied. IP name lookup faile
d [10.100.25.12]”.
Thanks,
Wes
Wes,
Thanks for the response. It is a different username and password than the one I am currently logged into. I set it up to run as a task and will let you know if that resolves my issue.
Failed, still askign for username and password. Is there a way to hardcode a username and password into the script?
Jay, the password is hardcoded in the report.txt file.
(C:\scripts\vmwarevSphereHealthCheck.pl –server vCenterServerName –username “YourUserName” –password “YourPassword” –type datacenter –datacenter )
The script should call upon this file which should get you the desired result. Please let me know if you have already done this and we can look into this a little more.
Thanks,
Wes
Here is my script:
perl C:\software\VMWareScripts\DEV\AdminScripts\PerlScripts\vmwarevSphereHealthCheck.pl -server VCNAME –username uname –password pwd -type vcenter -report c:\health_check.html
$pp = Get-Process perl
$pp.Waitforexit()
I have to put the perl in front for it to run from the ps script. If i run in command line it still asks for username and password.
Jay, sorry I have to verify everything. I have seen these kinds of issues before. Lets try to manually run the command if you already haven’t. Open PowerCLI, make sure it has no issues connecting to the host and run the following command.
C:\scripts\vmwarevSphereHealthCheck.pl –server vCenterServerName –username administrator –password localadminpass –type datacenter –datacenter “DataCenterName” –report C:\scripts
Keep me posted with the results.
-Wes
this command gives me required option ‘type’ not specified
OK, this sounds like the datacenter name is invalid or missing.
OK so here is how I ended up getting it to work. Incase anyone else comes across this issue. Thanks Wes for the help. When I typed in your command(not copy and paste) i was finally able to get it to work by being in the directory and useing the .\vmwarevSphereHealthCheck.pl …. Here is the script in the meantime for anyone else:
$today = Get-Date
$today.AddDays(-1)
$targ = “YOURPATH\health_report” + $today.Month + “.” + $today.Day + “.” + $today.Year + “.htm”
cd SCRIPT_LOC
.\vmwarevSphereHealthCheck.pl -server vcenter-us-002 -username uname -password pwd -type vcenter -report c:\health_check.html
sleep 5
$pp = Get-Process perl
$pp.Waitforexit()
cp YOURPATH\health_report.htm $targ
del YOURPATH\health_report.htm
cp c:\health_check.html YOURPATH\health_report.htm
del c:\health_check.html
Excellent! And I do appreciate the follow up. Anything that might help other people get this working for their environment. If you find something else that needs to be updated, please let me know.
everything else works good now. Thanks