dnack
asked on
Remote shutdown using runas and shutdown.exe
Hi currently i have a UPS that only support 1 computer. However the UPS software on this computer can perform to run script before shutting down when power failure. The first computer is a domain controller and the remote computer is a member server of the same domain.
I try to automate this script to shut down another computer when power failure.
the script run like this
shutdown.exe /s /f /m \\remotecomputer
When i double click this cmd file, it works. However when the real power failure occurs, the UPS software execute this cmd file and has a "acess denied" reply. It seem that the UPS software has no access right to shutdown another computer.
I try to use runas but i need to enter a password.
I also try using echo password | runas /user:domain\administrator script.cmd
I do not want to use a thrird party software. Any way out?
Rdgs
Dnack
I try to automate this script to shut down another computer when power failure.
the script run like this
shutdown.exe /s /f /m \\remotecomputer
When i double click this cmd file, it works. However when the real power failure occurs, the UPS software execute this cmd file and has a "acess denied" reply. It seem that the UPS software has no access right to shutdown another computer.
I try to use runas but i need to enter a password.
I also try using echo password | runas /user:domain\administrator
I do not want to use a thrird party software. Any way out?
Rdgs
Dnack
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I know you said you didn't want to use third party software, but I too was having problems getting the shutdown command to function the way I wanted, so I switched to PsShutDown by Systernals [ www.systernals.com ]
I believe it was one of sirbounty's posts from last year that informed me of it.
If interested, you can download for free from:
http://www.sysinternals.com/Utilities/PsShutdown.html
I believe it was one of sirbounty's posts from last year that informed me of it.
If interested, you can download for free from:
http://www.sysinternals.com/Utilities/PsShutdown.html
hi,
you can use 3rd party tool, such as lsrunas (http://www.lansweeper.com/ls/lsrunas.aspx)
to run with admin rights, but your password 'll be hashed in this way.. check it out
you can use 3rd party tool, such as lsrunas (http://www.lansweeper.com/ls/lsrunas.aspx)
to run with admin rights, but your password 'll be hashed in this way.. check it out
Create a user account with administrative permissions on both machines, for example "SrvUPS". Then change the service's properties to use this account instead of "Local System".
Just noticed that I missed sirbounty's suggestion, sorry. Must be getting blind, so ignore that last one.
ASKER
Thanks guys for so many feedback. I will try all suggested ways. However, my client would not allow me to try on his server this week. Probably need to schedule a downtime with him sometime next week or week after. Will upate the result ang give points accorddingly.
Rdgs
Dnack
Rdgs
Dnack
Script 1:
REM To be run by the UPS software to initiate a shutdown
echo Shutdown > C:\UPS_Shutdown.txt
Script 2:
REM Configure this script to be run as a service using SVRANY
REM First delete any existing shutdown file
del C:\UPS_Shutdown.txt
:LOOP
REM Wait a bit before checking whether to shutdown...
sleep 30
REM Check for our shutdown file. If it doesn't exist, sleep a bit longer...
if not exist C:\UPS_Shutdown.txt goto LOOP
REM The shutdown file exists, so initiate the shutdowns...
REM Now do the shutdowns...
shutdown.exe /s /f /m \\remotecomputer1
shutdown.exe /s /f /m \\remotecomputer2
The service can be created using INSTSRV.EXE
The utliities used - SRVANY, INSTSRV and SLEEP - are all part of the Windows Resource kit. There's good help in there on setting up a service using INSTSRV and SRVANY. You can get the resource kit from http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en
If you've got lots of computers to shutdown, put their names in a text file and use a FOR /F command in the second script to get their names from the file and shut them down.