VMware Cloud Community
sfortuna74
Contributor
Contributor
Jump to solution

Issue with Powershell Healthcheck script when running as scheduled task

Hello -

We have successfully implemented the extremely helpful VMWare Healthcheck script posted here at http://communities.vmware.com/docs/DOC-7430. One baffling problem which we've been having is that

when the script runs as a scheduled task (called out by a batch file) the recipient will receive an email with the report attached, however the content of said report is more or less empty.

When we run this same batch file manually, we are emailed the report and it is fully populated. I understand this seems completely illogical, but could anyone help us to understand why this is happening?

Thanks very much -

Steve

Reply
0 Kudos
1 Solution

Accepted Solutions
JoeLyons
Enthusiast
Enthusiast
Jump to solution

I just replicated your issue:

I ran the script with a user who has no rights to the virtual center server but is an admin on the box:

Heres the result:

VMware Health script

Date and time

03/04/2009 15:58:28

VMware ESX server Hardware configuration.

VMware ESX server versions and builds.

VMware VC version.

Snapshots active.

CDROMs connected.

Floppy drives connected.

Datastore space available.

Datastore

UsedGB

FreeGB

PercFree

0

0

Virtual Machine information.

VMware timesync not enabled.

There may be a problem with permissions on that account.

Remember to back EVERYTHING up before you change ANYTHING

Remember to back EVERYTHING up before you change ANYTHING and consider awarding points if answers where helpful to you.

View solution in original post

Reply
0 Kudos
9 Replies
JoeLyons
Enthusiast
Enthusiast
Jump to solution

Hi Steve,

Just to get the obvious out of way because someone will ask you if I don't.

Is it running on the same box youi manually ran it on?

Is it using the same account?

Remember to back EVERYTHING up before you change ANYTHING

Remember to back EVERYTHING up before you change ANYTHING and consider awarding points if answers where helpful to you.
Reply
0 Kudos
sfortuna74
Contributor
Contributor
Jump to solution

Yes, script is on same box and account is running same credentials.

Reply
0 Kudos
JoeLyons
Enthusiast
Enthusiast
Jump to solution

Ok,

I just tried this and it worked without any issue - seems very strange :smileyshocked:

When you say "more or less empty"

Are the headings there but no data or some data?

Are you running the scheduled task using a batch file to execute?

Joe

Remember to back EVERYTHING up before you change ANYTHING

Remember to back EVERYTHING up before you change ANYTHING and consider awarding points if answers where helpful to you.
Reply
0 Kudos
sfortuna74
Contributor
Contributor
Jump to solution

I'll copy and paste what we receive in our file attachment - The running theory with the team is that the script must be running however something is amiss with Powershell. To make matters more confusing, when I initialy tested last week using scheduled task, things were working. Then a day or two later, we started getting the following -

VMware Health script

Date and time

03/04/2009 08:56:02

VMware ESX server Hardware configuration.

VMware ESX server versions and builds.

VMware VC version.

Snapshots active.

CDROMs connected.

Floppy drives connected.

Datastore space available.

Datastore

UsedGB

FreeGB

PercFree

0

0

Virtual Machine information.

VMware timesync not enabled.

Reply
0 Kudos
JoeLyons
Enthusiast
Enthusiast
Jump to solution

The script is running alright, but all your get-vm etc seem to be failing.

Try this:

Schedule the task:

Log into the system running the scheduled task as the user running it before it fires.

You should see the command prompt box open and be able to watch the script run.

You may see an error thats points to the problem.

Joe

Remember to back EVERYTHING up before you change ANYTHING

Remember to back EVERYTHING up before you change ANYTHING and consider awarding points if answers where helpful to you.
Reply
0 Kudos
JoeLyons
Enthusiast
Enthusiast
Jump to solution

I just replicated your issue:

I ran the script with a user who has no rights to the virtual center server but is an admin on the box:

Heres the result:

VMware Health script

Date and time

03/04/2009 15:58:28

VMware ESX server Hardware configuration.

VMware ESX server versions and builds.

VMware VC version.

Snapshots active.

CDROMs connected.

Floppy drives connected.

Datastore space available.

Datastore

UsedGB

FreeGB

PercFree

0

0

Virtual Machine information.

VMware timesync not enabled.

There may be a problem with permissions on that account.

Remember to back EVERYTHING up before you change ANYTHING

Remember to back EVERYTHING up before you change ANYTHING and consider awarding points if answers where helpful to you.
Reply
0 Kudos
sfortuna74
Contributor
Contributor
Jump to solution

You were absolutely right - We must not have taken the required rights on the remote boxes into consideration when we created the task - and thought strictly of admin rights on the box the VI Toolkit was running on... Thank you VERY much for helping us with this...

Steve

Reply
0 Kudos
JoeLyons
Enthusiast
Enthusiast
Jump to solution

Glad I could help.

Remember to back EVERYTHING up before you change ANYTHING

Remember to back EVERYTHING up before you change ANYTHING and consider awarding points if answers where helpful to you.
Reply
0 Kudos
bandersfdjhefjh
Contributor
Contributor
Jump to solution

I have exactly the same issue but trying accounts that has both local admin and Virtual center does not seem to do the trick.

I did however notice that once you set the Scheduled tasks credentials to be the same as the currently logged in user then it worked just fine but never when they differ so it must be some context-related permission problem and all help is appreciated.

Reply
0 Kudos