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.
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.
***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 )
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.