I have been reading up on how to get a script to run when a specific alarm is triggered.
To that order, I created a .BAT file on the VC server, calling a PS1 script. When I run the batch file from CMD on the VC server, everything works just fine and the script completes successfully. When the alarm rings though the script does not run, in the configuration field I entered :
C:\windows\system32\cmd.exe /c c:\scripts\myscript.bat
Again, the script works fine when launched from command prompt on the VC server, so it does have to do with VC. I have tried with the Execution Policy set to both Unresricted and remotesigned, to no avail. Any help will be appreciated, thank you.
Did you already check out Carter's blog post How to run PowerCLI scripts from vCenter Alarms ?
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have, thank you. The script runs from CMD on the VC server, the interaction with VC though does not work. I though the way I am running the script will interact with VC under the VPXD account.
Do you use the Connect-VIServer cmdlet in your script to connect to the vCenter server? This cmdlet will establish the connection with the vCenter server. E.g.:
$vCenterServer = Connect-VIServer -Server YourvCenterServer.YourDomain.YourCountry -User Username -Password Password
Robert
Yes, thank you. I had to resort to put the username and the password in the script to make it work.