Search code examples
powershelloutlookpowershell-2.0

Change Outlook Default PST using PowerShell


I want to do the following using PowerShell.

  1. Create a new PST file "Data1.PST"

  2. Mark the file "Data1.PST" as default.

  3. Delete the original default PST file.


Solution

  • Not in PS or Outlook Object Model alone - you need to use Extended MAPI (C++ or Delphi) or Redemption (any language, I am its author) or ProfMan (comes with the distributable version of Redemption).

    Redemption - if you are already dealing with an active Outlook Session. Use RDOSession.Stores.DefaultStore to open the default store. Use RDOPstStore.PstPath to figure out the path to the PST file. To add a new PST store, use RDOSession.Stores.AddPstStore. You can then change the RDOStore.Default property to true.

    ProfMan (if you want to manipulate the existing profiles without actually logging in) - see an example at https://www.dimastr.com/redemption/profman_examples.htm#example4. -