Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to auto-reboot XP pro?

Status
Not open for further replies.

cbailey

MIS
Dec 12, 2001
129
US
I have a problem running a script that reboots a PC at a given time. After adding the task in scheduler, I found that if the screen is locked, shutdown or reboot will not work. (they work in NT and 2000 Pro). TweikUI is not supported in XP.

Any ideas?

Thanks

[ponder]
 

Question?
what command are you using for reboot?
are u using the shutdown.exe command?

lovalles
 
Yes, I am using shutdown.exe for Windows 2000, I couldn't find one for XP. This version will only take me back to a GUI Novell login prompt.
 
Somethings to check out here.



840%40tkmsftngp03&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DISO-8859-
1%26q%3D%2522shutdown%2B-s%2B-f%2522%252Bshutdown%252Bwindows%252Bxp%
252Bsafe%26btnG%3DGoogle%2BSearch


HOW TO: Increase Shutdown Time So That Processes Can Quit Properly in Windows XP


shutdown%2Bbefore%2Bcache%2Bwindows%2Bxp

2Bxp&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N
 
Create a shortcut to shutdown.exe with the parameters shown:
C:\WINDOWS\system32\shutdown.exe -r -t 01

Then create a scheduled task, pointing to this shortcut.
 
I still have the problem of when the screen is locked. shutdown.exe will not work.

Is there anything that can over-ride the screen lock? If I can do this, I'll be home free.

Thanks
 
there are some Shutdown stuff regarding SP1. So install it then check it out.


Athlon
 
there are some Shutdown stuff regarding SP1. So install it then check it out.


lovalles
 
Installing SP1 did the trick, I didn't know XP had a shutdown.exe of its own. After the update the shutdown command worked.

Thanks for the help.
 
Well, at least SP1 worked on one PC. On another Windows XP workstation, set up just like the working one, Reboot will only work after the screen is unlocked, it will resume.

So much for consistancy

I'm having so much trouble with the screen lock in XP.

Any ideas?

Thanks
 
***NOTE: If I receive no reply to this within two days, I will start a new thread for this topic.

I have the same problem as cbailey; however, I *do* have the latest windows updates installed (as of 01/09/05).

I am using the August 2004 version of shutdown.exe; although it still fails with the 2002 version.

I have a script that runs as a Scheduled Task (authorized via the Administrator account) and reboots the PC after passing a few checks (such as no users logged in, >24 hours since last boot, etc.). The script works without fail with Windows 2000. It works with Windows XP, too, if the Administrator is logged in; otherwise, it will NOT. I do not have to use Administrator for the script to work; but since Administrator owns/authorizes the Scheduled Task, I will use it for illustration purposes.

I use "fast switching" and the script will run as long as I log in as Administrator and either remain logged in or "switch user" to return to the welcome screen. But it will not run if I do neither. So, in effect, I could set XP to automatically log in as Administrator and then run a login script for Administrator that automatically locks the workstation. This would return immediate control to the Welcome Screen and, since the Administrator is logged in, the script would run without jeopardizing security.

This is *NOT* what I would like to have happen, though. I want the script to run without having to have a user logged into the PC. Also, I do not want my Administrator's user id visible to other users in the Welcome Screen.

I would like to have the PC reboot (via script) from the Welcome Screen (i.e., with fast switching) without having to log in. I thank you in advance for your help.

Removing all of the logic for my pass checks, below are the two methods I have tried thus far (simply save each as a .vbs file and schedule a task for that script file). Again *EVERYTHING* works on Win2k, but only on XP if the Administrator (owner of the Scheduled Task) is logged in.



*******************************************************************************
Method #1: Using the Reboot() method:
*******************************************************************************
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Reboot()
Next





*******************************************************************************
Method #2: Using the shutdown.exe method:

shutdown.exe is in the same path as the script.
*******************************************************************************
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objNetwork = CreateObject("WScript.Network")
shutdownOptions = " -r -t 20 -c " & Chr(34) & "Shutting Down " & objNetwork.ComputerName & "..." & Chr(34) & " -f -d p"
intReturn = objShell.Run( "shutdown.exe" & shutdownOptions, 10, False )

 
I received a reply on another forum that absolutely works every time.


********************************************************************************
As an experiment, try PsShutdown, tip 4086 in the 'Tips & Tricks' at
Specify the credentials.

Are you running Service Pack 2?

Jerold Schulman - Sysop - Windows Server MVP

JSI, Inc. - ********************************************************************************


Hope it helps someone else in the future. Stay away from Microsnot's shutdown and use this one instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top