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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting Question

Status
Not open for further replies.

ITR

MIS
Joined
Oct 10, 2002
Messages
62
Location
US
I need a way to have a script reboot a few times while its running.

For example, run lines 1-10, reboot, run lines 11-20, reboot, etc, etc.

I'm guessing I could have it write to a text file before each reboot, and have the script check the text file on startup for where it needs to start(line 1 or line 11).

Any advise/guidence/help?



 
How about this: write the script with command line parameters, so that if you call "script.wsf" it runs lines 1-10, if you call "script.wsf /2" it runs lines 11-20, "script.wsf /3" runs lines 21-30, etc. Then, the last thing your script does in each section, before rebooting, is to write a value to the registry in HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce that will call the script again after the next logon with the next command parameter in the sequence. In other words, assuming line 10 is the reboot command, line 9 would write "script.wsf /2" into that key.

For more information on the RunOnce key and its relatives, see this TechNet article:

-pcorreia
Did I Help? Vote!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top