Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 593
  • Last Modified:

Close all Outlook pst files automatically.

I want to close outlook pst files that remain open (users lock their session instead of closing it) before backup. Backup fails everytime a pst file is open. The status is corrupt. How I can force (script or gpo) the file to be closed prior to my backup.

Thanks.
0
hamda000
Asked:
hamda000
  • 2
1 Solution
 
David LeeCommented:
Hi, hamda000.

"How I can force (script or gpo) the file to be closed prior to my backup."
You can't force a PST file to close while Outlook is still open.  The only solution is to close Outlook itself.  
0
 
hamda000Author Commented:
What I meant is to force Outlook itself to close so I can't have a fail backup with corrupt pst files.
0
 
David LeeCommented:
You can do that with a bit of scripting (below), so long as the script is run in the context of the logged in user.  However, when Outlook goes to shut down it will prompt the user to empty Deleted Items if Outlook is configured to empty Deleted Items on exit.  The prompt would prevent Outlook from shutting down until someone responds to it or unless you have a utility that will watch for that dialog-box and click the button for you.
Dim olkApp
On Error Resume Next
Set olkApp = GetObject(,"Outlook.Application")
If TypeName(olkApp) <> "Nothing" Then
    olkApp.Quit
End If
Set olkApp = Nothing

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now