Here is an Exchange Shell script to archive all users within an organisational unit (Disabled Users) to a network path.
Prerequisite is to grant built-in security group Exchange Trusted Subsystem with modify access to network path.
$mailboxes = Get-mailbox –OrganizationalUnit “DOMAIN.LOCAL/CompanyName/Disabled Users” foreach ($mailbox in $mailboxes) { $name = $mailbox.Name if(!(Test-Path "\\[FILESERVER]\Archive$\$name\")) { MD "\\[FILESERVER]\Archive$\$name\PST\"} New-mailboxExportRequest -Mailbox $mailbox -FilePath "\\[FILESERVER]\Archive$\$name\PST\$name.pst" }