Sure. I'm assuming your NET usage is correct.
IF /i "%1"=="" GOTO FIRST_TIME
IF /i "%1"=="/REBOOT" GOTO SECOND_TIME
ECHO do stuff before reboot!
net localgroup administrators /DELETE Olrik
net localgroup users /ADD Olrik
ECHO Do what is needed to have this script kicked off after reboot
REG ADD HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUNONCE /v MyScript /t REG_SZ /d "c:\myscript.bat /REBOOT"
ECHO do other stuff after reboot!
ECHO Remove from registry
ECHO y|REG DELETE HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUNONCE /v MyScript >NULL
IF /i ... -- Regardless of case
ECHO y| REG DELETE ... -- It prompts "are you sure?" so pipe "y" (yes) into it
SHUTDOWN /r -- This SHOULD work for 2000 but it may be SHUTDOWN -r, I don't have 2000 box to test on ATM. SHUTDOWN /? will tell you, of course.
As always be careful with registry for anyone else reading you can cause your computer to stop working if you modify the registry so be sure you know what you're doing.
Any more questions feel free to ask.
EDIT: Deleting the RunOnce key might not be necessary, always test a script before setting it loose in an infrastructure
Edited by aikeru, 24 April 2008 - 07:39 AM.