If the script has to restart the computer the best bet is to get the script that restarts the computer to place an entry in the RunOnce value of the registry for the second part of the script?
This would only happen once the computer had logged back in but you could also script the registry auto login part. Then remove this at the start of the new script?
Just a thought