the goal of this script is:
- input computer name and restart it
- wait for it to come up
- sends new command
This all works great without step 2. What's happening is that, step two comes first and then the machine is restarted (step 1). I'm confused, here's the code:
nomePosto = InputBox("Nome do posto:", _
"Correção Cert DSM")
intAnswer = _
MsgBox("Ao continuar o posto " & nomePosto & " vai reiniciar!",_
vbOkCancel, "ATENÇÃO")
if intAnswer = vbOk Then
CONST comm1 = " shutdown -r -f -t 1"
CONST comm2 = " md c:\teste"
set wshShell = WScript.CreateObject ("Wscript.Shell")
wshShell.run "psexec \\" & nomePosto & comm1
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.navigate("about:blank")
.Document.Title = "Aguarde ..." & string(100, chrb(160))
.resizable=0
.height=100
.width=100
.menubar=0
.toolbar=0
.statusBar=0
.visible=1
End With
Do while oIE.Busy
wscript.sleep 500
Loop
oIE.document.body.innerHTML = "<div id=""countdown"" style=""font: 12pt sans-serif;text-align:center;""></div>"
for i=56 to 0 step -1
oIE.document.all.countdown.innerText= i
wscript.sleep 1000
next
wshShell.run "psexec \\" & nomePosto & comm2
oIE.quit
else
end if
Wscript.Quit