View Full Version : auto restart w2k (W2K)
Dozer
05-07-2002, 02:40 PM
'Mornin', all........
I need my HP Vectra running MS2K to restart by itself without any human watchdog making sure it does it right. I have the Shutdown.EXE file, but it doesn't have the capability to auto-restart...someone has to be there to push the buttons to make it restart. I can't find a string command to use with Task Rescheduler that will make the computer restart from a DOS prompt. HP refuses to tell me how to access the same string of events or files that make the Start/Shutdown/Restart sequence of the taskbar work.
Any ideas on how to A) make the computer restart using a string in a batch file that can be started by task scheduler, and B) how to make the Novell login work automatically, just as if I were logging on sitting in front of the machine? I need this functionality for a major Access project.
jdharm
05-07-2002, 10:15 PM
I've got an idea for A).
Create a *.vbs file that ignores running tasks and possible data loss and forces a shutdown and restart. The code and options are in this message:
<a target="_blank" href=http://www.winguides.com/forums/showthreaded.php?Cat=&Board=genwin&Number=46856&page=0&view=collapsed&sb=5>http://www.winguides.com/forums/showthreaded.php?Cat=&Board=genwin&Number=46856&page=0&view=collapsed&sb=5</a> (Glory be to Jama for this!)
I use the option of 6: that's 4 for forced log off + 2 for reboot. The hardware never shuts down, so no need to push buttons.
Then use the task scheduler to run the script whenever.
Josh
"I love deadlines. I especially love the whooshing sound they make as they go flying by."
Dozer
05-07-2002, 10:49 PM
This is huge...mega....brilliant! However, I know virtually nothing about .vbs. I pasted the code into a word doc, then changed the extension to .vbs, then used task scheduler to test it. It didn't work...came up with an error...
The error is:
script: c:\winnt\restart.vbs
line: 1
char: 1
error: invalid character
code: 800a0408
source: Microsoft VB Script compilation error
so, did I miss something? Are there things to change in that script besides replacing the "XX" with a command option number?
Thnaks... you can contact me privately @ todd@kaypark.com if you prefer.
Andy-S
05-07-2002, 10:55 PM
Did you copy the -----------------------------.
You only need the information between the lines i.e.
Set objSystemSet = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown )}")_
.InstancesOf("Win32_OperatingSystem")
For Each objSystem In objSystemSet
objSystem.Win32Shutdown XX
Next
Cheers
Andy
Dozer
05-07-2002, 10:59 PM
nope....my copy started with the word "Set".
Andy-S
05-07-2002, 11:14 PM
I tried the script on my W2K machine and it worked with no problems. I'm not sure what could cause your problem so sorry, but you'll have to wait on one of the scripting experts to provide an answer.
Cheers
Andy
You need to combine the first two lines into one.
1- Use notepad and make sure it is not wrapping text. Click Format and de-select Word Wrap if it’s selected
2- Delete the underscore character between (Shutdown)}") and .InstancesOf
So your code should look like this; “I can’t display the full line here because this webpage will automatically wrap it”;
…………. impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem")
3- Make sure there are no spaces between (Shutdown)}") and .InstancesOf.
Tip; Always use notepad to copy code, it won’t add a space character to the end of each line. In the file save as dialog box type “restart.vbs” with the quotes “”. This way notepad will not change the file extension.
If you have any problems let me know.
Jama
b414213562
05-08-2002, 01:42 AM
The problem was that he used word, not notepad, and vb choked on one of the formatting characters at the beginning of the file.
Dozer, make sure you follow Jama's post about using notepad. If you use Word, you will have problems. Notepad is a pure text editor, and thus doesn't store formatting information at the beginning of the file. This formatting information is what vb can't understand. If you create a new word document, you'll see that it's about 10K. That 10K is stuff that's not your script.
Good luck.
Dozer
05-08-2002, 07:24 PM
Thanks....got it to work!
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.