VMware

This Question is Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
4 Replies Last post: Nov 4, 2009 10:23 AM by LucD  

[vCenter] Alarm and script being triggered really slow posted: Oct 29, 2009 5:10 AM

Click to view Cayne's profile Novice 9 posts since
Mar 11, 2008

Hi,

I created an alarm that trigger a powershell script.

Here is the script triggered: "C:\PowerOnSpareWeb.bat"

date /t > c:\PowerOnSpareWeb.log
time /t >> c:\PowerOnSpareWeb.log
powershell.exe -command "C:\PowerOnSpareWeb.ps1" >> c:\PowerOnSpareWeb.log
date /t >> c:\PowerOnSpareWeb.log
time /t >> c:\PowerOnSpareWeb.log

Here is the powershell script: "C:\PowerOnSpareWeb.ps1" (its purpose is to poweron VMimages in a specific ressource pool)

Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer -server localhost -User administrator -Password admin
Get-ResourcePool StandbyWebServers | Get-VM | Start-VM

The problem i have is the following:

As soon as the alarm is triggered here is what i see:

  1. The script is properly triggered because i can see that a file called PowerOnSpareWeb.log appeared in the c: directory with the date and time
  2. I can see in my task manager that powershell.exe is starting but then nothing is happening for 5 minutes approx.
  3. After 5 min. I have an error message in vCenter: A general system error occured: failed to run script: Script timed out, terminated
  4. As soon as the error message appear, my VM images are powered on as expected

What is strange is that if i run my .bat script in command line, everything is running smoothly without any problem


So it seems like vCenter is trying to do something and after it timed out it runs the script.

As anybody faced it already and has a solution ?

Any help would be really appreciated

Thanks

Click to view harkamal's profile Hot Shot 221 posts since
Mar 19, 2009

I am facing the same situation, powershell.exe runs under vpxd.exe process and does nothing for 4-5 minutes. I am using following commandline in alarm script action
cmd.exe /c c:\Windows\system32\windowspowershell\v1.0\powershell.exe -command "& c:\al.ps1"
Click to view LucD's profile Champion 2,431 posts since
Oct 31, 2005
I can confirm, the dot-vertical bar construct works great.
Good find :-)

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities