Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84328members
353490posts

Powerchute Personal Edition - Run external commands with this utility

APC UPS for Home and Office Forum

Schneider Electric support forum for our APC offers including Home Office UPS, Surge Protectors, UTS, software and services and associated products designed to share knowledge, installation, and configuration.

Solved
PCS_apc
Crewman
Crewman
0 Likes
14
1409

Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 9/11/2011


Hi all,

I guess there are a few of us in the same boat here, With BackUPS's and the Powerchute Personal Edition, and wanting to run an external command just before the system hibernates or shuts down, ie to send an email or shutdown VM's

Well, I have written a small utility that intercepts the shutdown / hibernate commands from the Powerchute application and this allows you to run an external command, as well as setting a delay before the system resumes the hibernate / shutdown procedure as it would normally

This utility was written and tested with Powerchute Personal Edition ver 3.0.0.1 on Windows 7

To install:

1) Navigate to your Powerchute folder - ie "C:\Program Files\APC\PowerChute Personal Edition"
2) Rename the existing apcrun.exe to apcrun1.exe
3) Download the attached zip file and extract to your Powerchute folder, ie "C:\Program Files\APC\PowerChute Personal Edition"
4) Edit the included APC_CMDExecutor.ini file and set the actions to take

Settings
HibernateCommand = "C:\tempunthis.bat"
ShutdownCommand = "C:\tempunthis.bat"
HibernateDelay = 8
ShutdownDelay = 8
Debug = 0

If your system has hibernate enabled, then set your external command in the hibernate command field,
Otherwise if your system shuts down instead of hibernating then set your external command in the shutdown command field.

The delays will delay the shutdown or hibernate commands being sent to the system for X seconds, this is to allow your custom command above to execute fully before continuing with the shutdown

The debug field will pop up a box showing what command was piped by powerchute, for normal operation leave this = 0

The program is provided as is with no warranties and at your own risk, I will not be responsible for any damage caused to your system or software by using this app.

To test your custom external command:
Start - run
cmd
cd "C:\Program Files\APC\PowerChute Personal Edition"
apcrun Local\IDD_HIBER_WARNING - to test the hibernate command -OR-
apcrun Local\IDD_SHUTDOWN_WARNING_XP -to test the shutdown command

Attachments

Accepted Solutions
BillP
Administrator Administrator
Administrator
0 Likes
0
1408

Re: Powerchute Personal Edition - Run external commands with this utility

This reply was originally posted by Bill on APC forums on 1/4/2019


Hi Dana,

When PowerChute Personal Edition is installed it enable hibernation in the OS. You have the shutdown options within PowerChute to keep the computer on as long as possible or preserve battery power. Keep computer on as long as possible with keep the computer running until the battery has x minutes left of life and then the OS will be commanded down. preserve battery power will command the OS down after running on battery for a set period of time. Depending on which setting you select (the default is preserve battery power) when the threshold is reached the OS will be commanded down and the system will hibernate. 

NOTE: If you do not want the system to hibernate the setting can be disable by opening a command prompt as an admin and entering powercfg.exe /hibernate off. If hibernation is off the OS will shutdown same as selecting shut down from the run menu. 

See Answer In Context

14 Replies 14
Crazy_apc
Cadet
0 Likes
0
1409

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 9/21/2012


Hello.

Can you pelase Upload the File again? When i want to open it it says it's corrupt

Thanks a lot!!!

power270_apc
Cadet
0 Likes
0
1409

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 1/7/2012


Can you upload your attachment again. I try to open it and it says its corrupt.

ltpolaris_apc
Cadet
0 Likes
0
1409

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 1/14/2012


Thanks for posting this.

I gave it a try on a Win 7 x64 box.. Unfortunately, was not successful.. It would launch the executable, throw up the dialog box indicating that it was launching my script, but my script never launched, and the hibernate delay settings never took hold. It kicked off the hibernation process and the delay was always 10 sec, not the 60 sec I specified in the .ini file.

Thinking it might be a path issue (Program Files x86) vs Program Files, I took your files and copied them to the Program Files folder for giggles.. No difference

Any suggestions appreciated

Thanks, Jim

amd.64_apc
Crewman
Crewman
0 Likes
0
1410

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 1/22/2013


What I would like is to get an email if the server has been running on battery for 5 minutes. Is this possible?

BillP
Administrator Administrator
Administrator
0 Likes
0
1410

Re: Powerchute Personal Edition - Run external commands with this utility

This reply was originally posted by Jonathan on APC forums on 1/23/2013


amd.64,

If you are going to use PCPE to achieve that, it is not possible. You might need to create an extensive script to do that.

kowc527_apc
Cadet
0 Likes
0
1410

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 6/5/2012


Thanks PCS! I tried your program on a Windows Server 2008 and it works like a charm!
I actually registered in this forum just to thank you!

I had placed the apcrun.exe in the folder:
C:\Program Files (x86)\APC\PowerChute Personal Edition

My APC_CMDExecutor.ini file:
[Settings]
HibernateCommand = "D:\PowerMonitor\shutdown.bat"
ShutdownCommand = "D:\PowerMonitor\shutdown.bat"
HibernateDelay = 300
ShutdownDelay = 300
Debug = 0

milloy_apc
Cadet
0 Likes
0
1410

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 3/16/2013


This would be great, but doesn't seem to work on Win8 Pro. At least, not when I'm logged-in via a Remote Desktop session. 😞

BillP
Administrator Administrator
Administrator
0 Likes
0
1410

Re: Powerchute Personal Edition - Run external commands with this utility

This reply was originally posted by Ivan on APC forums on 3/25/2013


Thnaks! tried from WIndows 2003 Server and works OK (at least from within a session, just waiting for a real powert outage to test if it will run from powerchute itself!)

simon123_apc
Cadet
0 Likes
0
1410

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 3/29/2013


I had the same problem as

But I found a solution that really solves my problem:

http://www.apcupsd.com

dr1rrb_apc
Cadet
0 Likes
0
1410

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 4/29/2015


I found an easy solution which does not require any external software! My solution does not perfectlly match the original problem, but when I was searching to my problem I found this thread which drives me to the right solution.

For info, my config is Win Server 2012 R2 with the Hyper-V role installed and I use PCPE 3.0.2. My goal is to keep my server running some few minutes and then gracefully power it down. As I've Hyper-V installed I cannot enable the "Hibernation", and PCPE will turn off power instead of gracefully switching off my computer.

  1. Configure PowerChute to "Keep my computer on as long as possible" (the idea is to turn the computer off before PCPE try to do it)
  2. Open task scheduler and create a task executed on power blackout:
    • Trigger:
      • Event
      • Event log: Application
      • Source: "APC UPS Service"
      • Event ID: 174
    • Action: Whatever you want! In my case:
      • Program: C:\Windows\System32\shutdown.exe
      • Parameters: /s /f /t 120 /c "Auto shutdown due to power failure." /d 6:12
  3. Create a second task to abort shutdown if power is restored:
    • Trigger:
      • Event / Application / "APC UPS Service" / 61455
    • Action:
      • Program: C:\Windows\System32\shutdown.exe
      • Parameters: /a
  4. Unplug your UPS to test ! 😉

The great thing with this solution is that you can also easily send email (http://caspian.dotconf.net/menu/Software/SendEmail/) after 5 minutes on battery if you want.

jinx10000_apc
Cadet
0 Likes
0
1409

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 6/14/2018


I just wanted to say I've left my computer unplugged from my APC since I first got the UPS because I was told by support there was no way to keep the battery providing power after the PC shuts down if its connected via USB. 

I haven't been able to get the graceful shutdown or access to battery stats.  Either that or I have to leave the PC on and let it drain the power quickly.  My goal was to quickly power down my computer and leave the remaining juice to power my network.  

Support and many sites said this was not possible which seems like a God awful HUGE oversight in the software design. 

Anyways I used your method in task scheduler to power down my computer and everything else stayed running so I'm very happy with those results.  Thank you. 

Kenbob_apc
Cadet
0 Likes
0
1409

Re: Powerchute Personal Edition - Run external commands with this utility

This was originally posted on APC forums on 12/20/2018


Thank you David. You are the MAN!

BillP
Administrator Administrator
Administrator
0 Likes
0
1409

Re: Powerchute Personal Edition - Run external commands with this utility

This reply was originally posted by Dana on APC forums on 1/4/2019


So you're telling me there is NO OFFICIAL way of shutting down the computer?

BillP
Administrator Administrator
Administrator
0 Likes
0
1409

Re: Powerchute Personal Edition - Run external commands with this utility

This reply was originally posted by Bill on APC forums on 1/4/2019


Hi Dana,

When PowerChute Personal Edition is installed it enable hibernation in the OS. You have the shutdown options within PowerChute to keep the computer on as long as possible or preserve battery power. Keep computer on as long as possible with keep the computer running until the battery has x minutes left of life and then the OS will be commanded down. preserve battery power will command the OS down after running on battery for a set period of time. Depending on which setting you select (the default is preserve battery power) when the threshold is reached the OS will be commanded down and the system will hibernate. 

NOTE: If you do not want the system to hibernate the setting can be disable by opening a command prompt as an admin and entering powercfg.exe /hibernate off. If hibernation is off the OS will shutdown same as selecting shut down from the run menu.