Auto restart of window 7 pc gracefully

Hello,

We have a pc that we would like to restart nightly. the catch is that we cannot force the restart as Microsoft outlook is installed and running. is there a way to bring down the applications and then restart the machine once they are done?



If the Windows Task Scheduler does not work for you, have you tried an additional software as?:http://www.passmark.com/products/rebooter.htm
http://lifehacker.com/5831504/how-can-i-start-and-shut-down-my-computer-automatically-every-morning
http://www.howtogeek.com/136087/automatically-shut-down-or-restart-your-pc-%E2%80%93-or-do-it-remotely-from-your-phone/
http://www.howtogeek.com/136087/automatically-shut-down-or-restart-your-pc-%E2%80%93-or-do-it-remotely-from-your-phone/
http://auto-restart.software.informer.com/

Or remote restart from another PC, wake-up on LAN...



If the Windows Task Scheduler does not work for you, have you tried an additional software as?:http://www.passmark.com/products/rebooter.htm
http://lifehacker.com/5831504/how-can-i-start-and-shut-down-my-computer-automatically-every-morning
http://www.howtogeek.com/136087/automatically-shut-down-or-restart-your-pc-%E2%80%93-or-do-it-remotely-from-your-phone/
http://www.howtogeek.com/136087/automatically-shut-down-or-restart-your-pc-%E2%80%93-or-do-it-remotely-from-your-phone/
http://auto-restart.software.informer.com/

Or remote restart from another PC, wake-up on LAN...



I assume you are using task scheduler to do the shutdown and are using the shutdown command to do the restart. I would just change the command to the following:
shutdown /l /f /r

/l = log off any user
/f = force close any program without prompt
/r = restart



thanks flubbster. yes this is through safe mode. The only issue is forcing the close...i am assuming this doesn't shut down outlook gracefully, correct? The reason i ask is when the machine comes back up, if outlook did not close down it prompts to start in safe mode.



Any open program is "forced" to shutdown.



i created a script to do the following which worked:
delay = 30000 'delay in milliseconds to let Outlook close gracefully
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" _
& strComputer & "rootcimv2")

'If Outlook is running, let it quit on its own.
For Each Process in objWMIService.InstancesOf("Win32_Process")
If StrComp(Process.Name,"OUTLOOK.EXE",vbTextCompare) = 0 Then
Set objOutlook = CreateObject("Outlook.Application")
objOutlook.Quit
WScript.Sleep delay
Exit For
End If
Next

'Make sure Outlook is closed and otherwise force it.
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Outlook.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

wscript.sleep delay

Set objWMIService = Nothing
Set objOutlook = Nothing
Set colProcessList = Nothing

Set WSHShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:WINDOWSsystem32shutdown.exe -r -t 0"

Share this

Related Posts

There was an error in this gadget