Fix Outlook OST/PST Max Size Limit with PowerShell

By Michael J. Thomas

I decided to look into some of my projects I did in the past and post some of them here. I created this project when I saw mailboxes that were really large in size like over 50 Gb which were freezing up the outlook mailbox on the local system and users were not able to send out their email. The server had plenty of space with Office 365 but there were no group policies in place at the time that allowed the systems to have even larger OTS/PST files on the local system. 

I created a local solution to fix these right away. One is a program that I made with PowerShell Studio that you can copy to the computer and set the size. The other solution is a PowerShell script that allows you to set the permissions to a remote computer and user. Check them both out and let me know what you think. Hopefully, you will find this to be a handy tool. Enjoy!

GUI for Fix Outlook OST/PST Max Size Limit Project

#Set-OSTLimit Function below is used to set the size of the OST/PST file on a remote system for a remote user.  

function Set-OSTLimit
         [string] $ComputerName,
         [string] $UserName,

# 'OST/PST file MaxLargeFileSize Enter GB'
$MaxLargeFileSize = 1024 * $SizeGB
Write-Host "MaxLargeFileSize $MaxLargeFileSize MB"
$WarnLargeFileSize = $MaxLargeFileSize * .95
Write-Host "WarnLargeFileSize $WarnLargeFileSize MB"
$Value01 = $MaxLargeFileSize
$Value02 = $WarnLargeFileSize
$SID = (Get-ADUser -Identity $UserName).SID.Value 

# Command to invoke on remote computer edit registry for the user.
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
$Name01 = "MaxLargeFileSize"
$Name02 = "WarnLargeFileSize"
$RegPath = "Microsoft.PowerShell.Core\Registry::HKEY_USERS\$Using:SID\Software\Microsoft\Office\*\Outlook\PST"
If (Test-Path $RegPath) {
New-ItemProperty -Path $RegPath -Name $Name01 -Value $Using:Value01 -PropertyType DWORD -Force 
New-ItemProperty -Path $RegPath -Name $Name02 -Value $Using:Value02 -PropertyType DWORD -Force 




Popular posts from this blog



Mike's Profile Cleanup Tool