Skip to content

Instantly share code, notes, and snippets.

@Xeckt
Created June 30, 2021 12:59
Show Gist options
  • Save Xeckt/5a52d235fd28578f328cf3050184379d to your computer and use it in GitHub Desktop.
Save Xeckt/5a52d235fd28578f328cf3050184379d to your computer and use it in GitHub Desktop.
Set Outlook PST Max Size
$global:OutlookPstMaxFileSize = 0
$global:ComputerName = [System.Net.Dns]::GetHostName()
$global:Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('CurrentUser', $global:ComputerName)
$global:OutlookDataSizeRegistryPath = $global:Registry.OpenSubKey("Software\Microsoft\Office\16.0\Outlook\PST", $true)
$FileSize = Read-Host "Write file size in GB for max PST size"
$global:OutlookDataSizeRegistryPath.SetValue("MaxLargeFileSize", ([int]$FileSize * 1024))
# I'm using $global variables for convenience as this script may be added to later to include more outlook functionality and registry interactions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment