Maintain control of your Microsoft 365 data
			
		
		
			
				
																			
								robotrobot94 							 
						Lurker 			
		Posts:  2Liked:  1 time Joined:  Jul 22, 2025 2:23 pm
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by robotrobot94  Jul 22, 2025 8:12 pm 
				
			
			
			
			Hello,
I've been looking through the forums/google to find a way to export bulk mailboxes to individual psts simultaneously. I've found multiple older threads on exporting these sequentially, but nothing at the same time. If anyone has any insight or code they can provide that I can use as a base, that would be great. 
If anyone needs a script for doing this sequentially, the script is below.
Code: Select all 
# Import Modules for Veeam interaction
Import-Module Veeam.Archiver.PowerShell
Import-Module Veeam.Exchange.PowerShell
# Starting Restore Session with latest Restore Point
$organization = Get-VBOOrganization -Name "ORG Name"
Start-VBOExchangeItemRestoreSession -LatestState -Organization $organization
# Starting the PST Export for all users in the csv
$session = Get-VBOExchangeItemRestoreSession
$database = Get-VEXDatabase -Session $session
$Mailboxes = Import-Csv C:\temp\mailboxes.csv 
# Function to sanitize file names
function Sanitize-FileName($name) {
    return ($name -replace '[\\/:*?"<>|,]', '').Trim()
}
# Loop through each mailbox from your csv file.
ForEach ($mailbox in $Mailboxes) {
       $user = Get-VEXMailbox -Database $database -Name $mailbox.Name
       $sanitizedName = Sanitize-FileName $mailbox.Name
       Export-VEXItem -Mailbox $user -To "V:\Downloaded PSTs\Test Exports\$sanitizedName.pst"
}
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								Mildur 							 
						Product Manager 			
		Posts:  11023Liked:  3026 times Joined:  May 13, 2017 4:51 pmFull Name:  Fabian K.Location:  Switzerland
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by Mildur  Jul 23, 2025 8:43 am 
				
			
			
			
			Hi robotrobot94,
I haven't tried it myself, but have you considered using 
Start-Job  to run PowerShell commands in the background?
This should allow your script to continue and start the export for other mailboxes.
Best,
Fabian
Product Management Analyst @ Veeam Software
			
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								robotrobot94 							 
						Lurker 			
		Posts:  2Liked:  1 time Joined:  Jul 22, 2025 2:23 pm
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by robotrobot94  Jul 23, 2025 2:23 pm 
				1 person likes  this post
			
			
			
			Hey Mildur,
Thank you for pointing me in the right direction. I'm relatively new to PowerShell and a newbie, so I didn't know much about Start-Job. With that being said, I got the script to work for me!
Below is the script I used, which worked for me.
Code: Select all 
# Import Veeam modules in parent session
Import-Module Veeam.Archiver.PowerShell
Import-Module Veeam.Exchange.PowerShell
# Get the organization and start restore session
$organization = Get-VBOOrganization -Name "Org Name"
Start-VBOExchangeItemRestoreSession -LatestState -Organization $organization
# Get restore session and database info
$session = Get-VBOExchangeItemRestoreSession
$database = Get-VEXDatabase -Session $session
# Save database ID (so it can be passed to jobs)
$databaseId = $database.Id.Guid
# Load CSV of mailboxes
$mailboxes = Import-Csv C:\temp\mailboxes.csv
# Create jobs for each export
foreach ($mailbox in $mailboxes) {
    $name = $mailbox.Name
    $sanitizedName = ($name -replace '[\\/:*?"<>|,]', '').Trim()
    $outputPath = "V:\Downloaded PSTs\Test Exports\$sanitizedName.pst"
    Start-Job -ScriptBlock {
        param($orgName, $dbId, $mailboxName, $filePath)
        # Re-import modules in the job context
        Import-Module Veeam.Archiver.PowerShell
        Import-Module Veeam.Exchange.PowerShell
        # Re-establish session
        $org = Get-VBOOrganization -Name $orgName
        Start-VBOExchangeItemRestoreSession -LatestState -Organization $org | Out-Null
        $session = Get-VBOExchangeItemRestoreSession
        $database = Get-VEXDatabase -Session $session | Where-Object { $_.Id.Guid -eq $dbId }
        $user = Get-VEXMailbox -Database $database -Name $mailboxName
        Export-VEXItem -Mailbox $user -To $filePath
    } -ArgumentList $organization.Name, $databaseId, $name, $outputPath
}
# Wait for all jobs to finish and check output
Get-Job | Wait-Job
Get-Job | Receive-Job
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								Mildur 							 
						Product Manager 			
		Posts:  11023Liked:  3026 times Joined:  May 13, 2017 4:51 pmFull Name:  Fabian K.Location:  Switzerland
				Contact: 
				
			 
				
		 
		
						
					
																			
						
									
						Post 
					 
								by Mildur  Jul 25, 2025 12:53 pm 
				
			
			
			
			You're welcome.
			
			
									
						
							Product Management Analyst @ Veeam Software
			
						 
		 
				
		
		 
	 
	
	
	
		
		Users browsing this forum: No registered users and 5 guests