Task Schedular not allowing vbscript popups
Please seek assisstance at: http://social.technet.microsoft.com/Forums/pl-pl/ITCG/threadsMohammed Imtiyaz Ali
May 8th, 2012 8:04am

Hi, i am using a script i found to commence a windows 7 shutdown of my pc in my domain. the way i want it to work is a scheduled task calls a vbscript that set the computer to shutdown in 5 minutes, but also gives the user a chance to cancel it. the script works fine when run manually, but when set off by task schedular it shutdown in 5 minutes, but stops allowing the user to cancel the shutdown (no popup appears to cancel shutdown) Shutdown Script Const wshOK = 0 Const wshExclamation = 48 strComputer = "." strShutdown = "shutdown.exe /f /s /m \\" & strComputer strCounter = 1 Set objShell = CreateObject("Wscript.Shell") strTimeLeft = 5 Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'explorer.exe'") If colItems.Count = 0 Then 'a returned 0 meanins explorer is not present and no one is logged in objShell.Run strShutdown 'since no one is logged in the shutdown command is issued. End If while strCounter < 11 intReturn = objShell.Popup("Your computer will shutdown in " & strTimeLeft & " minutes. Click OK to cancel the shutdown.",30, "Shutdown Pending", wshOK + wshExclamation) If intReturn = 1 Then objShell.Popup "Shutdown has been cancelled!", 6,"SHUTDOWN CANCELLED", wshOK + wshExclamation Wscript.quit 0 End If strTimeLeft = strTimeLeft - .5 strCounter = strCounter + 1 Wend objShell.Run strShutdown =============================================================== Task Schedular Script SCHTASKS /Create /RU "NT AUTHORITY\SYSTEM" /NP /SC DAILY /TN Shutdown /RL HIGHEST /TR "c:\shutdown.exe" /ST 18:00 /V1
Free Windows Admin Tool Kit Click here and download it now
May 8th, 2012 2:30pm

Try running your scheduled task with the interactive switch (/IT) but with a non-system account.  The SYSTEM account does not have interactive logon rights, hence, users are unable to see or interact with programs or tasks running under this account.Regards, Salvador Manaois III MCSE MCSA CEH MCITP | Enterprise/Server Admin Microsoft Certified Solutions Associate http://www.badzmanaois.com
May 8th, 2012 10:36pm

Please seek assisstance at: http://social.technet.microsoft.com/Forums/pl-pl/ITCG/threadsMohammed Imtiyaz Ali
Free Windows Admin Tool Kit Click here and download it now
May 9th, 2012 12:46am

Hello, I have a similar Problem (with Windows XP) and I tried the program "serviceui.exe" found in MicrosoftDeploymentToolkit 2012. It seems to solve the problem. My commandline: schtasks /create /tn "ShutdownOnIdle" /sc ONIDLE /i 30 /ru "System" /tr "%CD%\serviceui.exe \"%SystemRoot%\system32\wscript.exe\" \"//nologo %CD%\ShutdownOnIdle.vbs\"" Informations can be found here: http://blogs.technet.com/b/cameronk/archive/2010/04/27/creating-a-user-interactive-task-sequence-experience.aspx Regards, Ralf
May 12th, 2012 7:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics