Link to home
Create AccountLog in
Windows XP

Windows XP

--

Questions

--

Followers

Top Experts

Avatar of Marck911
Marck911🇪🇸

Problem with Shutdown command over batch file
Hi all, im using the software (winpower) that came with an UPS  (forza SL-51)  to manage the events when the power suply AC fails, what im trying to do is to run a batch file when defined time is out to turn of a remote computer using shutdown command, the software gives this option  User generated image and the batch file halt.bat  User generated image , the problem comes when time over the and the batch file execute nothing happend and return this message on the log.txt  User generated image, i already check that the user name runing the winpower has the same username with administrative permition to shutdown the remote computer, in fact if i run the command over cmd it works.

Any ideas=?
thanks in advance.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of sjklein42sjklein42🇺🇸

I am concerned about the

>log.txt

in your batch file.

It assumes a working directory that you can write into.

It is not clear what the working directory of this batch job will be when it executes.

Try using

shutdown.exe -m \\pcname -f -s -t 30>c:\log.txt

Open in new window


or whereever you want the log file to go explicitly



Avatar of Marck911Marck911🇪🇸

ASKER

the write directory its the same of shutdown command and it works,
i tryed and same result,
thanks for the quick response

Avatar of sjklein42sjklein42🇺🇸

Here's another place to look for shutdown privileges:

Start/Run --> gpedit.msc

Go to
Computer Configuration\Windows Settings\Security Settings
\Local Policies\User Rights Assignment\

Double click on "Shut down the system"

Verify that the following groups are listed:

Administrators
Backup Operators
Power Users
Users

Then do the same thing for

 "Force shutdown from a remote system"

and be sure Power Users and Administrators is in the list.  Users, too, just in case.


See this article for the discussion leading to this suggestion:

http://www.pcreview.co.uk/forums/shutdown-exe-doesnt-run-due-lack-privileges-t179004.html


Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


SOLUTION
Avatar of QlemoQlemo🇩🇪

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Danny ChildDanny Child🇬🇧

I'd also consider looking at the PSshutdown tool from WinInternals (who Microsoft liked so much, they bought them...)

http://technet.microsoft.com/en-us/sysinternals/bb897541

very similar in a lot of ways, but more robust.

Do you know what context the application is running in?  It may not have the same permissions that you do...
You can explicitly add login details to the command line, but it's a hideous security breach to leave your login and password in plain text forever.  Might be handy for the troubleshooting though.  

Avatar of QlemoQlemo🇩🇪

Adding credentials in the batch was suggested for troubleshooting only, of course.

Avatar of Marck911Marck911🇪🇸

ASKER

Thankyou all, I'll test and post the result tomorrow...

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Marck911Marck911🇪🇸

ASKER

guys I tryed with the domain controller user using this command:
psshutdown.exe \\pcname -u USER -p PASS -k -t 100 -m " Shutting Down..." 1>output.log 2>error.log
and again return message was: Access Denied.
I ran the command manually and it works.
If i set the winpower to launch batch file with the above command-> Access Denied.
If i set the winpower to launch the command directly -> Access Denied.

also I tryed sjklein42's idea with gpedit.msc and added two different users and notting.

any ideas?

ASKER CERTIFIED SOLUTION
Avatar of sjklein42sjklein42🇺🇸

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.

Avatar of Marck911Marck911🇪🇸

ASKER

Thanks to all, the right way was adding the user to the winpower service. because its based on java the javaw process started with the user with permition to turn off the remote computer.
Windows XP

Windows XP

--

Questions

--

Followers

Top Experts

Microsoft Windows XP is the sixth release of the NT series of operating systems, and was the first to be marketed in a variety of editions: XP Home and XP Professional, designed for business and power users. The advanced features in XP Professional are generally disabled in Home Edition, but are there and can be activated. There were two 64-bit editions, an embedded edition and a tablet edition.