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
84386members
353577posts

Scripting Remote Server Shutdown

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
McGroarty_apc
Crewman
Crewman
0 Likes
6
619

Scripting Remote Server Shutdown

This was originally posted on APC forums on 8/24/2007


Team,

My goal is to be able to script automatic shutdowns using the command file setting option found in the PowerChute Business Edition. Unfortunately (hence the post), I've not gotten this to work correctly.

I'm using Windows 2003 Enterprise Edition (64 bit) with PowerChute Business Edition 7.05 (agent, server, console, connected directly to UPS). I've created two test files (see below) that are both located in the \cmdfiles directory. The first file is a *.cmd file which initiates a *.bat file. Triggering either of these files outside of the APC software initiates the desired action. However, the files do not function as desired when the file is selected and I click on "Test" on the "Configure Shutdown Sequence" screen. Both APC services are logging on with an account that has been given domain admin privileges (heightened privileges to help rule out permissions issues). I do believe that the syntax of both files indicated below is correct. Obviously I have a rather simple batch file at the moment as I want to get it to work correctly before adding any additional variables.

Thanks in advance for your input, thoughts, and ideas.

Colin M. McGroarty

PowerOut.cmd (C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles)_
@echo off
rem
rem Maximize for best viewing
rem This command file provides examples of proper command file syntax
rem
rem Command Files run by PowerChute Business Edition must be placed in this directory.
rem
rem Use the full path name of executable programs and external command files.
rem
rem The @START command must be used to run executable programs (see example below).
rem For the @START command, path names that include spaces must be enclosed in quotes;
rem arguments for the executable must be outside the quotes. A double quote must
rem precede the quoted path name. For example, to execute a command file in
rem c:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles called myShut.exe,
rem the following line should be entered in the command file:
rem
rem @START "" "c:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles\myShut.exe"
rem
@echo on
@START "" "C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles\PowerOut.bat"

PowerOut.bat (C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles)*
C:\WINDOWS\system32\shutdown /s /m \ \apps-01.mcgroarty.net /t 360

Note: Space in above line (\ \) inserted deliberately due to newsgroup formatting


Accepted Solutions
McGroarty_apc
Crewman
Crewman
0 Likes
0
619

Re: Scripting Remote Server Shutdown

This was originally posted on APC forums on 8/28/2007


Thanks for the input. This tells me that the domain admin account I'm using should suffice and tells me that I do not have an error with the script.

Does anyone have any additional thoughts? I'm assuming such scripting has to be pretty commonplace and would like to hear if anyone else is having any success using this method to shutdown remote systems.

See Answer In Context

6 Replies 6
netmastan_apc
Crewman
Crewman
0 Likes
0
620

Re: Scripting Remote Server Shutdown

This was originally posted on APC forums on 2/14/2009


Hi Guys,

I'm trying to shutdown a mac server using putty and ad the following command

@START "" "C:\windows\putty.exe" -ssh macserver -l root -pw xxx -m c:\shutdownmac.sh

I typed the command in the default.cmd file and did a test .. it doesn't do anything.However when I manually double click on the file it shutdown the mac server.So, putty is working so the command. I've tested a simple command mkdir it works so APC is actually executing the comamnd file. I guess either my syntax is incorrect for APC to understand or something going on.

I've even tried this @START "" "C:\windows\putty.exe" -ssh macserver -l root -pw xxx -m "c:\shutdownmac.sh"

shutdowmac.sh simply contain the following code

shutdown -r now

I'm running windows 2003 server. I tried every thing mentioned in this forum..even google.
Any help will be great

netmastan_apc
Crewman
Crewman
0 Likes
0
620

Re: Scripting Remote Server Shutdown

This was originally posted on APC forums on 2/14/2009


Thank guys. It's working now 🙂
All I had to do is change login as Domain Administrator under login properties of APC PBE Agent services
And the following code I used

START "" "C:\windows\putty.exe" -ssh macserver -l root -pw xxx -m c:\shutdownmac.sh

Thanks again.

McGroarty_apc
Crewman
Crewman
0 Likes
0
620

Scripting Remote Server Shutdown

This was originally posted on APC forums on 8/24/2007


Team,

My goal is to be able to script automatic shutdowns using the command file setting option found in the PowerChute Business Edition. Unfortunately (hence the post), I've not gotten this to work correctly.

I'm using Windows 2003 Enterprise Edition (64 bit) with PowerChute Business Edition 7.05 (agent, server, console, connected directly to UPS). I've created two test files (see below) that are both located in the \cmdfiles directory. The first file is a *.cmd file which initiates a *.bat file. Triggering either of these files outside of the APC software initiates the desired action. However, the files do not function as desired when the file is selected and I click on "Test" on the "Configure Shutdown Sequence" screen. Both APC services are logging on with an account that has been given domain admin privileges (heightened privileges to help rule out permissions issues). I do believe that the syntax of both files indicated below is correct. Obviously I have a rather simple batch file at the moment as I want to get it to work correctly before adding any additional variables.

Thanks in advance for your input, thoughts, and ideas.

Colin M. McGroarty

PowerOut.cmd (C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles)_
@echo off
rem
rem Maximize for best viewing
rem This command file provides examples of proper command file syntax
rem
rem Command Files run by PowerChute Business Edition must be placed in this directory.
rem
rem Use the full path name of executable programs and external command files.
rem
rem The @START command must be used to run executable programs (see example below).
rem For the @START command, path names that include spaces must be enclosed in quotes;
rem arguments for the executable must be outside the quotes. A double quote must
rem precede the quoted path name. For example, to execute a command file in
rem c:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles called myShut.exe,
rem the following line should be entered in the command file:
rem
rem @START "" "c:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles\myShut.exe"
rem
@echo on
@START "" "C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles\PowerOut.bat"

PowerOut.bat (C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles)*
C:\WINDOWS\system32\shutdown /s /m \ \apps-01.mcgroarty.net /t 360

Note: Space in above line (\ \) inserted deliberately due to newsgroup formatting

dirtfoot_apc
Lt. Commander
Lt. Commander
0 Likes
0
621

Re: Scripting Remote Server Shutdown

This was originally posted on APC forums on 8/24/2007


Right click the PowerChute Business Edition Agent service, and check the "allow this service to interact with the desktop" box in the Logon tab, and try your test again. Any change in the results? If you are still having trouble with your script, try something even simpler like creating a directory or something - just to make sure that PowerChute is atleast attempting to run the script.

McGroarty_apc
Crewman
Crewman
0 Likes
0
621

Re: Scripting Remote Server Shutdown

This was originally posted on APC forums on 8/24/2007


Thank you for the superfast reply.

I can use the APC tool successfully in conjunction with super simple commands, create file for example. Changing the service account from a named account to local service with desktop interaction did not however solve the issue.

Kind Regards,

Colin M. McGroarty

McGroarty_apc
Crewman
Crewman
0 Likes
0
620

Re: Scripting Remote Server Shutdown

This was originally posted on APC forums on 8/28/2007


Thanks for the input. This tells me that the domain admin account I'm using should suffice and tells me that I do not have an error with the script.

Does anyone have any additional thoughts? I'm assuming such scripting has to be pretty commonplace and would like to hear if anyone else is having any success using this method to shutdown remote systems.