Avatar of Manuel Boosch
Manuel Boosch
 asked on

Powershell Script with HP Power Protector


i have an VMWare Environment with 2 x ESXi Host in a HA-Cluster. This Environment is connected to a HP 3000 UPS with a HP UPS MGMT Module. I have installed a W2012R2 VM running on this Cluster and installed HP Power Protector ver. 1.04 on this VM.

Now i wrote a powershell script for shutting down the VMWare vSphere HA-Cluster and this script (c:\temp\ups.ps1) is running fine if i run it locally on my W2012R2 VM.

Now i set the HPPP to run a script and set it up for the path "powershell c:\temp\ups.ps1". But it does not work when i use the "Test Shutdown" Button - as mentioned before the script is running fine when i start it manually.

I wrote a test script with the only information to restart the vm:

shutdown -r -t 00

saved this one to c:\temp\ups1.ps1.

Now i inserted this one in HPPP as script path "powershell c:\temp\ups1.ps1". Pressing the "Test Shutdown" button now works and restarts the VM directly.

Why it does not work with the other script in HPPP ? Im loading the VMWare Snapin at the beginning of my script to use PowerCLI commands..

Is there anything i missed ?
Server HardwarePowershellVMware

Avatar of undefined
Last Comment
David Johnson, CD

8/22/2022 - Mon
David Johnson, CD

many things like execution policy
powershell c:\temp\ups.ps1 change this to
c:\windows\system32\WindowsPowershell\v1.0\Powershell.exe -executionpolicy bypass c:\temp\ups.ps1
Jason Crawford

Can you provide the script?
David Johnson, CD

you said you already had the script but couldn't execute it my instructions are the ways to make it execute
Your help has saved me hundreds of hours of internet surfing.
Jason Crawford

I'm not the OP :)
Manuel Boosch

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
David Johnson, CD

Use the askers solution