我們的品牌

Impact-Company-Logo-English Black-01-177x54

歡迎造訪施耐德電機全球網站

歡迎訪問我們的網站
		
我们今天能为您提供什么帮助?
How to trigger a PowerShell script using PowerChute Network Shutdown?

Article available in these languages: 西班牙文, 法文

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.


PowerChute Services

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

探索更多
系列:
探索更多
系列:
  • 產品文檔
  • 軟體下載
  • 產品選型工具
  • 產品替代和替換
  • 幫助和聯絡中心
  • 尋找我們的辦公室
  • 取得報價
  • 施耐德電機社群
  • 人才招募
  • 公司簡介
  • 舉報不當行為
  • 無障礙
  • 新聞中心
  • 投資者
  • 專業洞察
  • 台灣施耐德電機學院
  • 綠色影響力落差調查
  • Schneider Go Green 2025
  • 隱私政策
  • Cookie通告
  • 使用條款
  • Change your cookie settings