Moving the ost-file of an Exchange, Outlook.com or IMAP account

Move OST-File buttonWhereas it is quite easy to set or change the location of pst-files belonging to a POP3 account, changing the location of the ost-file for an Exchange, Outlook.com or IMAP account is much more troublesome.

This can lead to issues as these files can grow quite large and the disk or partition on which you have Windows installed might not be accommodated for that. Especially if you invested in a fast SSD-drive, you usually don’t have GBs of space to waste and rather locate this data on your larger data drive.

While you can force the location of ost-files via Registry value, you’ll need to remove and re-add the account and download all mail again.

An effective and more direct solution is to use Symbolic Links. While the matter around them and how they function is quite complex, using them is luckily fairly easy and they are a very effective solution for this issue.


Method 1: ForceOSTPath Registry values

Registry Editor buttonIf you have the opportunity to remove and re-add your account and also re-download all your mail again from the mail server, then using the ForceOSTPath Registry value is the recommended way to go.

This Registry key allows you to set the default location for all newly created ost-files when adding an Exchange, Outlook.com or IMAP account to Outlook.

Key: HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\Outlook
Value name: ForceOSTPath
Value type: REG_EXPAND_SZ
Value: path to your storage folder

As the Value you give the path to the folder where you want to keep your ost-files. You do not need to use quotes for this path, even if it contains spaces.
Example; D:\Documents\Outlook Files

Note: Still using Outlook 2010 or previous with an IMAP account? Then use the ForcePSTPath instead as these versions of Outlook use a pst-file to cache IMAP data in.

You can control the location of newly created ost-files and pst-files via the ForceOSTPath and ForcePSTPath values in the Registry.
You can control the location of newly created ost-files and pst-files via the Registry.

More Info buttonWhat exactly Symbolic Links are and how they function is a bit too much and too complex to explain for this guide but you can use Wikipedia if you really want to learn more.

For now, you can look at Symbolic Links as advanced shortcuts which keep the original extension of the file that it is pointing to (instead of a lnk-file) which tricks the system into thinking that it is actually working with that file from that location rather than the location it is pointing to.

So, in our case, we are going to create a symbolic link for the ost-file in its original location on the system drive (C:\-drive) which points to the actual file on your data drive.

Note:
Even when you only have 1 drive or partition, you can use the method discussed in this guide to move the pst-file or ost-file to another location on that drive such as your Documents folder so that they for instance can be included in your backups more easily.

Creating Symbolic Links

Symbolic Link buttonTo create a Symbolic Link, you can use the MKLINK Command line tool or the New-Item PowerShell (version 5 or later) cmdlet. Whichever method you pick, the result is the same.

In the example below, we assume that the name of the ost-file is outlookcom.ost and that we move it from its original location to a location called D:\Documents\Outlook Files

  1. Close Outlook.
  2. Move the ost-file or pst-file from its original location to its new location.
    The default location is; C:\Users\%username%\AppData\Local\Microsoft\Outlook
  3. Open an elevated Command or PowerShell window.
    A quick way to do this is;
    1. Open the Start Menu and immediately type on of the following;
      • Command Prompt
      • PowerShell
    2. Right click on the result and choose; Run as administrator
    3. Provide administrator credentials for your computer or press “Yes” to accept the User Account Control prompt.
  4. Type one of the following commands (of course with your own file names and locations) depending on whether you are using the Command Prompt or PowerShell;
    • Command Prompt
      mklink "C:\Users\%username%\AppData\Local\Microsoft\Outlook\outlookcom.ost" "D:\Documents\Outlook Files\outlookcom.ost"
    • PowerShell
      New-Item -ItemType SymbolicLink -Path "C:\Users\%username%\AppData\Local\Microsoft\Outlook\outlookcom.ost" -Value "D:\Documents\Outlook Files\outlookcom.ost"

Tip!
You can actually leave the variable %username% in your command. Upon executing, the command it will automatically resolve it to your actual username.

Once you’ve created the symbolic link, the file icon will look like a shortcut in Explorer. However, instead of having the Shortcut file type, it still holds the ost-extension and the “Outlook Data File” file type (Windows 7) or the “.symlink” file type (Windows 10).

Its file size will report as 0KB but the file it is pointing to of course still holds its size; The link to that file simply doesn’t take up any disk space.

Comparison between the properties and look of a Symbolic Link, Shortcut and the original.
Comparison between the properties and look of a Symbolic Link,
Shortcut and the original file (which is marked with 2 in the name).

Undoing the changes
When you want to undo the changes, simply close Outlook, delete the Symbolic Link file like and other file and then move the ost-file back to its original location.

Creating Symbolic Links via a GUI based tool

Tools buttonAside from the command line tools provided by Microsoft, there are also several 3rd party tools available which allow you to create Symbolic Links via a user interface (GUI).

  • NTFS Link Ext
    This tool offers FSUTIL and Junction functionality via a GUI in Windows XP. This tool is no longer being maintained but neither is Windows XP ;-)
  • Link Shell Extension
    This tool works for all Windows versions and supports the creation of a Symbolic Link, Junction, Volume Mountpoint, Smart Copy, DeLorean Copy, Hardlink Clone and Symbolic Link Clone via a GUI. It also contains links to modified NTFS drivers for Windows XP which will allow for the use of real Symbolic Links.