Task Scheduler not working properly

Joined
Sep 7, 2018
Messages
2
Reaction score
0
I do a backup of my hard drive every night. In order to back up the Outlook pst files properly, Outlook must be closed before the backup is initiated. So I wrote a routine to close Outlook and placed it in a vbs file. The code for the vbs file is

On Error Resume Next
Set Outlook = GetObject(, "Outlook.Application")
If Err = 0 Then
Outlook.Quit()
End If


The vbs file name is:
D:\Documents\Program Downloads\Install\Close Outlook\Works with Windows 10\CloseOutlook.vbs

I tested the vbs file by double clicking on it when Outlook is open and Outlook immediately closes so I know that the vbs file works.

I set up a task in Task Scheduler pointing to this file but Outlook does not close at the scheduled time. When I look at the Task Scheduler log it says:

The operation was cancelled by the user. (0x8000704C7).

Can someone help me figure out what is wrong? I have looked online for a solution to this but have been unable to find one. Why does it work manually, but not in the Task Scheduler?
 
Joined
Nov 6, 2017
Messages
354
Reaction score
55
If you are not logged in when the task is scheduled to run, make sure to check the box marked "Run whether user is logged in or not".

Ben
 
Joined
Sep 7, 2018
Messages
2
Reaction score
0
My computer is always on and logged in. I tested with the computer on and logged in and I got the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top