APC UPS Data Center & Enterprise Solutions Forum
Schneider, APC support forum to share knowledge about installation and configuration for Data Center and Business Power UPSs, Accessories, Software, Services.
Posted: 2021-06-30 07:51 PM . Last Modified: 2024-03-07 01:57 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:51 PM . Last Modified: 2024-03-07 01:57 AM
I have a question regarding PCNS and the Run Command File setting.
I can correctly run a command when the Communication: Established event is fired. My problem is that the same command will not run when it is set under the UPS: On Battery event. We've tried to test it by setting the event length to a low value, like 10 second, then unplugging the UPS, but the command never runs. What am I missing?
Additional information: We've tried different scripts, including simple .bat scripts. I'm not wanting to actually shut down the system when it is on battery, just run the command, so that's why we are trying to configure the Run Command File setting when on battery. The NMC are on the latest version and it is PCNS version 2.2.4. This is on Windows 2008 R2.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:48 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:48 AM
I have finally got it to work. Don't know if what I was trying earlier wasn't supported or not, but I at least have it working the way that I want.
My previous installation was for a single installation but monitoring multiple ups devices.
When I reinstalled using a double installation and each one of those monitoring a single ups, the commands worked correctly for an on battery event.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:51 PM . Last Modified: 2024-03-07 01:57 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:51 PM . Last Modified: 2024-03-07 01:57 AM
I have a question regarding PCNS and the Run Command File setting.
I can correctly run a command when the Communication: Established event is fired. My problem is that the same command will not run when it is set under the UPS: On Battery event. We've tried to test it by setting the event length to a low value, like 10 second, then unplugging the UPS, but the command never runs. What am I missing?
Additional information: We've tried different scripts, including simple .bat scripts. I'm not wanting to actually shut down the system when it is on battery, just run the command, so that's why we are trying to configure the Run Command File setting when on battery. The NMC are on the latest version and it is PCNS version 2.2.4. This is on Windows 2008 R2.
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-30 07:52 PM . Last Modified: 2024-03-07 01:57 AM
i would start by [looking at this thread|https://community.se.com/t5/EcoStruxure-IT-forum/bd-p/ecostruxure-it-forum] and verifying everything that we went over with the original poster.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:57 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:57 AM
I have reviewed the post by winna and made sure to try everything in it.
I've setup a test.cmd script that has the following syntax to keep it as simple as possible, ver > c:\test.txt.
I then put the "c:\test.cmd" into the Run a Command File on event Communication Established and also in the On Battery event. I then unplugged/plugged the ethernet cable from the NMC to create a communications established event. This successfully created a test.txt file on the root of the drive. I then unplugged the UPS from power to create an On Battery event. This did not ever create a test.txt file.
I've included screenshots to show that the events did get logged in PCNS and also to show that the file was created only once. I've attempted this with the PCNS service running both as system (allowed to interact with the desktop) and also as the local admin account. Both had the same results.
I just find it weird that it works on one event and not the other. There should be no difference between the two.
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-30 07:52 PM . Last Modified: 2024-03-07 01:57 AM
Can you browse on the directory where you installed PCNS? The default installation folder is C:\Program Files\APC\PowerChute\group1. Once you are on that folder can you check if there is a file that says cmdfile.log. If you do you can open it up using NotePad and it should contain an error message on what went wrong.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
This is the only thing that the cmdfile.log file contains.
[Tue Nov 02 09:13:53 CDT 2010] -
[Tue Nov 02 09:13:53 CDT 2010] - C:\Program Files (x86)\APC\PowerChute\group1>ver 1>c:\test.txt
[Tue Nov 02 09:13:53 CDT 2010] -
[Tue Nov 02 09:13:53 CDT 2010] - C:\Program Files (x86)\APC\PowerChute\group1>exit
Do the different events interpret the command files differently?
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-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Based from my experience, PCNS can only execute a single line command file. If you need to call a multi-line command file you might want to create a single line command file and call the multi-line command file from there. The logs shows that both commands on the command file failed to execute, I am basing it from my experience. Please see Winna's post, it has the link on my experiment.
Also I suggest that you check this APC Knowledge Base [A command file is not running within PowerChute Network Shutdown|http://nam-en.apc.com/app/answers/detail/a_id/2441/kw/pcns%20command%20file]. This should give you an idea with regards to command file.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
So the two events are handled differently then since I can get it to work in one event, but not the battery event?
I am experimenting now with the single line command calling another command file.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
When running a command file off of the on battery event, it only looks at the time in the event configuration correct? It does not care about run times right because it is not part of the shutdown command?
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
For more information, I have just confirmed that the cmdfile.log file is created even when the command file runs successfully on the communications established event.
So we are still left with the same issue. The communications established event is not operating the same as the on battery event.
I have also installed PCNS onto two other computers with the same results. One being XP and the other Win Server 2003 x64.
Message was edited by: jjb80
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
I was out of the office today and will test this tomorrow when I get back in. I appreciate the additional ideas to test. Thank you.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Just tested it today with only one event configured to run a command file, that being the on battery event. Unfortunately it did not run the command when the ups was unplugged, and there was no cmdfile.log file generated to tell me any errors. It did log the on battery event in the PCNS log though. So it seen that the ups was unplugged.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:56 AM
You are thinking along the same lines that I already did. 🙂
Based on the previous post about PCNS only liking single line command files, I have two files setup for my testing. The first one, test1.cmd is the one that I call from the event. This file just calls the second test file, test.cmd, which contains the ver > c:\test.txt and then an exit command. I have tried appending the file and overwriting it. When I get a successful test on the communications established event, I make sure to delete the test.txt file to make sure I know it ran. I have also tried taking out the exit, so that I can look in the task manager to see if the conhost process is still running. I have also tried to run only the test.cmd file, but it results in the same action.
All of that occurring is still what makes me think that PCNS is not actually firing off the command in the on battery event.
I have not tried the threading issue that you suggested on another computer. I'll try that tomorrow.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:48 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-06-30 07:52 PM . Last Modified: 2024-03-07 01:48 AM
I have finally got it to work. Don't know if what I was trying earlier wasn't supported or not, but I at least have it working the way that I want.
My previous installation was for a single installation but monitoring multiple ups devices.
When I reinstalled using a double installation and each one of those monitoring a single ups, the commands worked correctly for an on battery event.
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.