<p>I'm trying to find a way to force Windows to reboot, and I am running into issues.  I've tried  </p>

<p><pre><code><code>Set OpSysSet = GetObject("winmgmts:{authenticationlevel=Pkt," _
     &amp; "(Shutdown)}").ExecQuery("select * from Win32_OperatingSystem where "_
     &amp; "Primary=true")
for each OpSys in OpSysSet
    retVal = OpSys.Reboot()
next</code></pre></code></p>

<p>I've also tried using the <code>shutdown -f -r</code> command, and in both cases I sometimes get no response, and if I try again I get an error saying "Action could not complete because the system is shutting down" even though no matter how long I leave it it doesn't shut down, it still allows me to start new programs, and doing a <code>shutdown -a</code> gives the same error.  How can a script be used to force Windows to reboot?</p>

Well, this uses VBScript -- although truthfully it invokes the same command line shutdown that you're trying to do.  I've tested it and it works.
```
```
Dim oShell 
Set oShell = CreateObject("WScript.Shell")

'restart, wait 5 seconds, force running apps to close
oShell.Run "%comspec% /c shutdown /r /t 5 /f", , TRUE
```
```
What OS are you running against?  This test was against XP.  I wonder if the server OS requires a shutdown code...