While rolling out an install of new AntiVirus, the machine will not reboot when told to by script. The "Post Install" command is as follows:
wscript RemoveNAVKey.vbs //B //Nologo
Inside RemoveNAVKey.vbs, this script removes a registry entry successfully if found. However, I can NOT get this script to reboot the pc. BUT, when the script is run FROM the machine manually, it successfully completes. Do keep in mind that there is no actual user logged onto the PC at the time. The script is run with admin rights. The snip of the code that is supposed to reboot is as follows.
Thanks in advance for any tips.
-SWarrior
wscript RemoveNAVKey.vbs //B //Nologo
Inside RemoveNAVKey.vbs, this script removes a registry entry successfully if found. However, I can NOT get this script to reboot the pc. BUT, when the script is run FROM the machine manually, it successfully completes. Do keep in mind that there is no actual user logged onto the PC at the time. The script is run with admin rights. The snip of the code that is supposed to reboot is as follows.
Code:
Set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
WScript.Sleep(120000)
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
For Each OpSys In OpSysSet
OpSys.Win32Shutdown EWX_FORCE
Next
Thanks in advance for any tips.
-SWarrior