How to trigger a PowerShell script using PowerChute Network Shutdown?
Issue:
Would like PowerChute Network Shutdown to trigger a Windows executable.
Product:
PowerChute Network Shutdown
Environment:
All supported Windows OS running PowerChute Network Shutdown version 4.4.x and above.
Solution:
To run a Windows PowerShell script from PowerChute, you must create two scripts: a .bat or .cmd file and a PowerShell script .ps1. We recommend using Notepad++ to avoid saving the files as .txt in Notepad or WordPad.
PowerChute will run a .bat, so we created Trigger.bat. That file consists of
"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Unrestricted -NoProfile -NonInteractive C:'\Temp\MyPowerShellScript.ps1'
You will need to verify or update the path to PowerShell.exe and modify the path to MyPowerShellScript.ps1. Also, all command files and script PowerChute Network Shutdown 4.4.x and above must be stored in
C:\Program Files\APC\PowerChute\user_files for Windows systems
/opt/APC/PowerChute/user_files/ for Linux systems
The second file is the .ps1 file. In the example below, we had PowerShell trigger my.exe
Start-Process "C:\Program Files\my.exe"
You will need to verify or change the path to the .exe
The command file runs using the local system account. You may need to modify the account settings to enable the script to run. To change the account, go to Control Panel—Administrative Tools—Services. In the example below, the user has been changed to wkadmin.
NOTE: PowerChute cannot execute programs that require interaction with the desktop; only command line-enabled programs are supported. For example, if you try to launch Notepad, it will fail. In earlier versions of Windows, all services ran in Session 0 along with applications. This situation poses a security risk. In Windows Vista and later versions of Windows, the operating system isolates services in Session 0 and runs applications in other sessions. PowerChute is run in Session 0, so if a command file launches an .exe, that .exe will be launched in Session 0 and will not be visible to logged-in users. To verify that the .exe has launched, open Task Manager and review the list of Processes running. More information on Windows Session can be found at http://blogs.technet.com/b/askperf/archive/2007/04/27/application-compatibility-session-0-isolation.aspx
發佈於: 施耐德電機Taiwan


需要協助?
產品選型工具
快速輕鬆地為您的應用找到合適的產品和附件。
取得報價
立即線上提交您的銷售需求,專業團隊將主動聯繫您。
購買地點
輕鬆在您所在地區找到最近的施耐德電機經銷商。
支援中心
在同一位置找到滿足您所有需求的支援資源。