Solved

Automatic Backup of Outlook connected to Exchange Server

Posted on 2008-10-13
5
552 Views
Last Modified: 2012-05-05
We need to backup Outlook automatically, every day.

Here are the circumstances:
Outlook 2007
Connected over Internet to Exchange Server.

There isn't a  .pst file.  There's an .ost file. My understanding of the  .ost  file is that it isn't the same as a .pst.  I don't know if backing up a copy of the .ost will help when there's damage to Outlook information.

Unless this is otherwise, I would like to have a complete export of the mailbox to a  local  .pst done every night automatically.  I am unsure of the scriptability of Outlook 2007.

Is there any software that would reliably do this?  The host makes a backup of the Exchange Server every night, but they want too much $$$ to perform a recovery.  If we had a local copy, we wouldn't have to get into an argument with them should we need to restore.  WE just had an incident where messages disappeared, and the host blamed us, and the rep asked if we 'had any proof' that they were responsible for the missing files.  

Thanks.

Larry
0
Comment
Question by:computerlarry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 97

Assisted Solution

by:war1
war1 earned 50 total points
ID: 22703321
Hello computerlarry,

Backing up the OST file will back up what is on the Exchange.  You will need Exchange server and Outlook to open OST file.  For PST file, you only need Outlook to open the file. (You can convert OST file to PST file, but will involve some cost.)

Hope this helps!
war1
0
 
LVL 76

Expert Comment

by:David Lee
ID: 22703715
Hi, computerlarry.

Outlook is very scriptable and copying everything to a PST file is pretty simple.  Running it at night though is a bit of a problem.  Outlook has to be running under the account that owns the mailbox for a script to work.  That means everyone would have to leave their computer logged in at night for the backup to run.  The workstation could be locked, but it would have to stay logged in.  Another approach would be to schedule the backup to run during the day.  I can provide the script if you want to go this route.  The script will have to be added to each computer.
0
 

Author Comment

by:computerlarry
ID: 22814961
BlueDF - could I please have that script?

Thanks.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 450 total points
ID: 22820292
Sure.  Here it is.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on Module1
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comments wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools > Trust Center
9.  Select Macro Security
10.  Ensure the security setting is one of the bottom two options
11.  Close Outlook
12.  Start Outlook

Run the macro whenever you want to backup the mailbox.
Sub BackupMailboxToPSTFile()
    'Change the path on the following line to your path
    Const BACKUP_PATH = "C:\eeTesting\Backups\"
    Dim strBackupFileName As String, _
        objFSO As Object, _
        olkRootFolder As Outlook.MAPIFolder, _
        olkFolder As Outlook.MAPIFolder, _
        olkFolderCopy As Outlook.MAPIFolder, _
        olkBackup As Outlook.MAPIFolder
    strBackupFileName = "BU " & Format(Time, "hhmm") & "_" & Format(Date, "dd mmm yyyy") & ".pst"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(BACKUP_PATH & strBackupFileName) Then
        MsgBox "The mailbox was already backed up within the last minute.", vbInformation + vbOKOnly, "Folder BackUp"
    Else
        Session.AddStore BACKUP_PATH & strBackupFileName
        Set olkBackup = OpenOutlookFolder("Personal Folders")
        olkBackup.Name = strBackupFileName
        Session.RemoveStore olkBackup
        Session.AddStore BACKUP_PATH & strBackupFileName
        Set olkBackup = OpenOutlookFolder(strBackupFileName)
        Set olkRootFolder = Session.GetDefaultFolder(olFolderInbox).Parent
        For Each olkFolder In olkRootFolder.Folders
            Set olkFolderCopy = olkFolder.CopyTo(olkBackup)
        Next
        Session.RemoveStore olkBackup
    End If
    Set objFSO = Nothing
    Set olkBackup = Nothing
    Set olkRootFolder = Nothing
    Set olkFolder = Nothing
    Set olkFolderCopy = Nothing
    MsgBox "Backup complete.", vbInformation + vbOKOnly, "Backup Mailbox to PST"
End Sub
 
Function IsNothing(obj)
  If TypeName(obj) = "Nothing" Then
    IsNothing = True
  Else
    IsNothing = False
  End If
End Function
 
Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
    Dim arrFolders As Variant, _
        varFolder As Variant, _
        olkFolder As Outlook.MAPIFolder
    On Error GoTo ehOpenOutlookFolder
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
    Else
        If Left(strFolderPath, 1) = "\" Then
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        End If
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            If IsNothing(olkFolder) Then
                Set olkFolder = Session.Folders(varFolder)
            Else
                Set olkFolder = olkFolder.Folders(varFolder)
            End If
        Next
        Set OpenOutlookFolder = olkFolder
    End If
    On Error GoTo 0
    Exit Function
ehOpenOutlookFolder:
    Set OpenOutlookFolder = Nothing
    On Error GoTo 0
End Function

Open in new window

0
 

Expert Comment

by:VicManuel
ID: 24175693
As would be code to copy all the *. pst? incremental *.pst
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question