VMware Cloud Community
Priyanki1112
Contributor
Contributor

Unable to run a powershell script while triggering an alarm for an webserver

Hi,

I am trying to execute a powershell script from batch file when an alarm is triggered.

I have used 'Run a command' action to invoke the script.

when the alarm is triggered, windows command like cd,dir,mkdir and etc given within the batch file are executed fine.

However, it fails to start the powershell script.

The contents of my bat file :

dir >> test.txt

set POWERSHELL=C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -nologo -noprofile -noninteractive
start %POWERSHELL% -command "&"%1""

Can some one tell me if i am missing something here?

Thanks in advance.

Reply
0 Kudos
2 Replies
Zsoldier
Expert
Expert

I'd recommend reading through this blog entry.  It's older, but still applicable in most cases.

http://blogs.vmware.com/vipowershell/2009/09/how-to-run-powercli-scripts-from-vcenter-alarms.html

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
Reply
0 Kudos
Priyanki1112
Contributor
Contributor

Thanks for the response.. i tried the steps from the blog..

but still havent managed to invoke the powershell script through my alarm action.

Reply
0 Kudos