Batch file to put remote PC into sleep/standby

Soldato
Joined
4 Jan 2004
Posts
7,752
Location
Nottingham
Hey Guys

Does anyone know if its possible to put a remote PC on a network into sleep/standby via a batch file?

I know you can shutdown and restart etc but a sleep/standby option would be very useful for me

Thanks
 
http://forums.overclockers.co.uk/showthread.php?t=18094859

I gave up trying in the end though as the PC I was trying to shutdown simply would not accept that I had administrator rights in order for it to allow the shutdown command on the remote pc, even though I am the only user on both pc's with the same name and password on each. Windows 7 on both, XP might not be so fastidious about it.
 
I have no issue running scripts to shutdown PC's over my network. I currently use a shutdown script to shut my file server down at night but I want to put it into sleep/standby instead so it boots quicker (plus I have more success getting WOL working lol)

PsShutdown looks interesting, I'll give it a try later
 
shutdown -s -m \\nameofpc
will shutdown a remote PC

psexec can run command on a remote machine with elevated privs if thats an issue

psexec \\nameofpc -u <username> -p <password> "shutdown -s"

so if you replace username and password with the admin username and password (without <> bits)
 
I don't need to shut it down. I can allready do that using the command you've just posted

I want to put the remote PC into standby/sleep mode instead. PsShutdown's suspend feature looks like it might do the job
 
Sorry did not read the question fully

for sleep
"rundll32 powrprof.dll,SetSuspendState"

this will set to hibernate if thats any help
"%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate"

You can use psexec to send these commands to a remote machine
 
thats the command I'm using at the min but it has to be run on the PC you want to put to sleep, I've not found anyway of running it remotely without remote desktopping to the PC....at least until now :)

If psexec works the way you say, that should be perfect
 
psexec \\nameofpc -u <username> -p <password> "rundll32 powrprof.dll,SetSuspendState"

or

psexec \\nameofpc -u <username> -p <password> "%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate"
 
I know this is a VERY late reply but I thought I should update this with the success I've had.

Using psexec as suggested by derkaderka, I've been able to successfully put my file server into standby using the below:

psexec \\server -s -d Rundll32 Powrprof.dll,SetSuspendState

With this setup I'm now able to put both my desktop and file server into standby so they start up much quicker than a standard 'cold boot', plus wake on lan works like a charm everytime without fail.

My previous experiences with WOL have taught me that if your trying to wake up a PC either on a LAN or over the net that's been shutdown totally tends to be a bit hit and miss. For me, majority of the time it wouldn't work.

HOWEVER, waking up a PC from standby (I believe it's S3?) over a LAN or the net has worked 100% everytime. I simply use the WOL feature in the Tomato firmware on my Linksys WRT54GL, but I believe the Depicious WOL tool will also work from a remote location (you may need to either allow multicast or allow UDP port 9 through your router?)

Hope this is of some help to someone, and thanks to everyone who replied :)
 
Back
Top Bottom