Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

Running scripts from powerchute syntax

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.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • APC UPS, Critical Power, Cooling and Racks
  • APC UPS Data Center & Enterprise Solutions Forum
  • Running scripts from powerchute syntax
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
BillP
Administrator BillP Administrator
5060
voidstar_apc
Janeway voidstar_apc
196
Erasmus_apc
Sisko Erasmus_apc
112
Teken
Spock Teken
109
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to APC UPS Data Center & Enterprise Solutions Forum
Solved
rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:22 AM . Last Modified: ‎2024-03-08 12:14 AM

0 Likes
11
2952
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:22 AM . Last Modified: ‎2024-03-08 12:14 AM

Running scripts from powerchute syntax

Hi

Im trying to run this which runs fine form the command line:

plink.exe -batch -ssh admin@192.168.1.1 -pw MyPassword -m "D:\Program Files (x86)\APC\PowerChute Business Edition\APC\PowerChute Business Edition\agent\cmdfiles\command.txt" > output.txt

I have understand I need to put full paths and the apostrophes in front of the path and arguments outside so I end up with this which fails, can I have apostrophes around paths in the arguments?

@START "" "D:\Program Files\PuTTY\plink.exe" -batch -ssh admin@192.168.1.30 -pw MyPassword -m "D:\Program Files (x86)\APC\PowerChute Business Edition\APC
\PowerChute Business Edition\agent\cmdfiles\command.txt" > output.txt

Any tips?

Many thanks

Labels
  • Labels:
  • UPS Management Devices & PowerChute Software
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:12 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:12 AM

Thanks for your work\thoughts Bill. Good to find that out

See Answer In Context

Reply

Link copied. Please paste this link to share this article on your social media post.

Replies 11
rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:14 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:14 AM

Sorry I should have added my platform is Smart-UPS SMT-SmartConnect - SMT750IC 

I running the script on Windows 2012 server, and the target to shutdown is a QNAP 451

tx

 

Reply

Link copied. Please paste this link to share this article on your social media post.

BillP
Administrator BillP Administrator
Administrator

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:14 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:14 AM

Hi,

PowerChute cannot execute programs that require interaction with the desktop; only command line enabled programs are supported e.g. if you try to launch Plink.exe it will fail. In earlier versions of Windows all services run 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 a .exe that .exe will be launched in Session 0 and not visible to the logged in users. More information on Windows Session can be found at http://blogs.technet.com/b/askperf/archive/2007/04/27/application-compatibility-session-0-isolation...

There is a work around. Anytime the PowerChute Agent records an event that event gets recorded to the Windows Event Viewer. You can schedule a task for an even and that task will trigger the .exe. 

Here is a link to a video that demonstrates how to create an task for a PowerChute event.

https://schneider-electric.box.com/s/6d0hpkq906r9l94sruibfg6c39mwzr2q

Reply

Link copied. Please paste this link to share this article on your social media post.

rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

On 4/26/2021 9:57 PM, Bill said:

Hi,

PowerChute cannot execute programs that require interaction with the desktop; only command line enabled programs are supported e.g. if you try to launch Plink.exe it will fail. In earlier versions of Windows all services run 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 a .exe that .exe will be launched in Session 0 and not visible to the logged in users. More information on Windows Session can be found at http://blogs.technet.com/b/askperf/archive/2007/04/27/application-compatibility-session-0-isolation...

There is a work around. Anytime the PowerChute Agent records an event that event gets recorded to the Windows Event Viewer. You can schedule a task for an even and that task will trigger the .exe. 

Here is a link to a video that demonstrates how to create an task for a PowerChute event.

https://schneider-electric.box.com/s/6d0hpkq906r9l94sruibfg6c39mwzr2q

Hi Bill

Thanks very much for this, although Im slightly confused as I thought I got it working, as I could run plink from a batch file from the test your script section from the powerchute ui in shutdown settings.

Does this mean that the testing of the script from the ui doesnt represent the same outcome if an actual powerchute event is handled?

Many thanks

 

Reply

Link copied. Please paste this link to share this article on your social media post.

rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

Also, Bill I couldnt ask.

I want the UPS to shut down a windows server 2012 and a NAS, I have a serial cable and a usb. I havent read anywhere that you can do it, but can you connect the smart ups to two devices one via usb and one via serial

 

Many thanks

 

Reply

Link copied. Please paste this link to share this article on your social media post.

BillP
Administrator BillP Administrator
Administrator

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

Yes that is exactly what it means.

Reply

Link copied. Please paste this link to share this article on your social media post.

BillP
Administrator BillP Administrator
Administrator

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

No unfortunately not, it's serial or USB, you'd need a NMC to shutdown multiple devices.

-Gavan

Reply

Link copied. Please paste this link to share this article on your social media post.

rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

Thanks for the confirmation

Reply

Link copied. Please paste this link to share this article on your social media post.

BillP
Administrator BillP Administrator
Administrator

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

Hi,

In each case PowerChute is executing the command file. As mentioned, PowerChute is running as a service and therefore runs in session zero. For security Microsoft separated services and application. When PowerChute calls the .cmd it runs however the .exe does not. The solution is to use task manager. If you were running a command line action you would not need the task manager.

Example: echo %time% >> C:\Temp\cmdtest.txt 

Another example: shutdown /s /f /m \\server ip /c "PowerChute has initiated a system shutdown" /t 0 to shut down a remote Windows OS. 

As for multiple systems connected using USB and Serial, as Gavan wrote, it is not recommended to use Serial and USB.

One notes, if one system runs shutdown, only software, i.e., not communicating with the UPS to configure the UPS, and one is running PowerChute; then you can connect two units utilizing both Serial and USB comm. 

An example: I have an Iomega NAS connected to Smart-UPS SMT1500 via USB. The Iomega only listens to the UPS; it does not send commands to the UPS (AKA Simple Signalling). On the Serial port, I have a Linux server connected running PowerChute. PowerChute is configured in Smart Signalling mode, so the communication is two ways. This configuration is acceptable as the PowerChute Server is the only device sending commands to the UPS.

Reply

Link copied. Please paste this link to share this article on your social media post.

rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

Thanks Bill, 

Really interesting, youre a font of knowledge on this.


So I have got this working now and thanks for your help but I am left foxed:

So I created a task on Win 2012 r2. that was listening for event 3000, lost communication

I had created a command file with the following contents that Powerchute would run, on my QNAP451 , on the on battery event of the Smart UPS

@START "" "D:\Program Files\PuTTY\plink.exe" -batch -ssh admin@192.168.1.1 -pw Password poweroff

I tested that powerchute could run this from the system settings ui

To find out the correct eventid , I took the power out from the ups to simulate the on battery event.

When I did this, the QNAP powered down gracefully, I checked the task history of the win 2012 task and it hadnt run, so it would seem the cmd file runs.

Is what you are saying that powerchute can run command line apps, but not exes with a ui.

It also seems that you can embed plink which doesnt have a ui in a batch file  and it can be run by powerchute


Best

 

 

 

 

 

 

Reply

Link copied. Please paste this link to share this article on your social media post.

BillP
Administrator BillP Administrator
Administrator

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

0 Likes
0
2950
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:13 AM

Rob,

I did more testing and found that when I change the PowerChute service account to an admin account the .exe would run.

3kaEBrqQwFgMbsJ9PVdKKw%3D%3D.png3kaEBrqQwFgMbsJ9PVdKKw%3D%3D.png

When leaving the service at the default local system account the .exe would not run. I had to use the task manager to launch the .exe. 

Attachments
Reply

Link copied. Please paste this link to share this article on your social media post.

rjtt64_apc
Ensign rjtt64_apc
Ensign

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:12 AM

0 Likes
0
2951
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2021-06-30 06:23 AM . Last Modified: ‎2024-03-08 12:12 AM

Thanks for your work\thoughts Bill. Good to find that out

Reply

Link copied. Please paste this link to share this article on your social media post.

Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

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.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of