APC UPS for Home and Office Forum
Support forum to share knowledge about installation and configuration of APC offers including Home Office UPS, Surge Protectors, UTS, software and services.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:14 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:14 AM
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
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:14 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:14 AM
Hello.
Can you pelase Upload the File again? When i want to open it it says it's corrupt
Thanks a lot!!!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:13 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:13 AM
Can you upload your attachment again. I try to open it and it says its corrupt.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:13 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 06:59 AM . Last Modified: 2024-03-21 05:13 AM
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
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
What I would like is to get an email if the server has been running on battery for 5 minutes. Is this possible?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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. 😞
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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!)
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
I had the same problem as ltpolaris, I'm runnning Windows 7 64-bits, and your app pops up saying it's running my script, but somehow the script doesn't really execute...
But I found a solution that really solves my problem:
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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.
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.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
Thank you David. You are the MAN!
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
So you're telling me there is NO OFFICIAL way of shutting down the computer?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-29 07:00 AM . Last Modified: 2024-03-21 05:13 AM
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.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.