PDA

View Full Version : How do I schedule a restart?



FzerozeroT
18-12-2002, 08:18 AM
How do I schedule a restart on XP Professional, can it be done?
Is there a file with a command anywhere that will restart a computer?

This is for a small business server that I want to fully automate.

Thanks anyone

Chilling_Silence
18-12-2002, 08:26 AM
I know that on a 98 boot disk there is a file called restart, might work in xp underr compatibilty mode perhaps, but HoneyLaser or SiK have previously reccommended some software that does just that I think :)

On the 98 boot disk, the file is called restart and it does just that, restarts it.

There's also a /switch you can use on the command.com file or something similar from what I understand. Otherwise, there's Autodown.exe, I think its available on the PCWorld site if you search for Autodown, and it lets you specify a time to close down your PC! (Shutdown, not restart).

Hope this helps


Chilling_Silence

CYaBro
18-12-2002, 08:43 AM
Copy and paste this script into a file and call it reboot.vbs (or whatever you like.vbs)


'Restart the PC for Windows XP/2k
set wmi = getobject("winmgmts:{(Shutdown)}")
set objset = wmi.instancesof("win32_operatingsystem")
for each obj in objset
set os = obj : exit for
next
'Create the number below by adding LOGOFF = 0, SHUTDOWN = 1, REBOOT = 2, FORCE = 4, POWEROFF = 8
os.win32shutdown 2


For the last line the 2 can be changed as it says for different actions.
Then all you need to do is create a scheduled task to run this file when you want.

FzerozeroT
18-12-2002, 09:10 AM
Does that just go into notepad then save with different extension?
I don't have visual basic

Chilling_Silence
18-12-2002, 09:16 AM
Yes.. And that's a much better solution that what I'd origionally said.

Save it in notepad, but make sure that you remove the .txt extension and replace it with .vbs!

CYaBro
18-12-2002, 09:35 AM
Yea Sorry! :(

Forgot that part. Right-click desktop then New - Text Document. Then give a name making sure that the .txt is now .vbs.

You probably will have to have change your settings though to show extensions for known file types.

This is done in any Windows Explorer window. Click Tools menu then Folder Options then View tab. Then uncheck box for 'Hide file extensions for known file types'

Hope this helps!

Cya

FzerozeroT
18-12-2002, 09:45 AM
Cyabro, another question,

is ansi format ok for that notepad doc?

Chilling_Silence
18-12-2002, 09:49 AM
Yup! Should be fine.

CYaBro
18-12-2002, 10:03 AM
Yes, Chilling Silence is right. ANSI is all good!