Skip to content

Instantly share code, notes, and snippets.

@AlexanderHolmeset
Last active March 16, 2022 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexanderHolmeset/f288cb9d72bba682b1e1aa5c41f9904f to your computer and use it in GitHub Desktop.
Save AlexanderHolmeset/f288cb9d72bba682b1e1aa5c41f9904f to your computer and use it in GitHub Desktop.
$PSTfiles = dir 'c:\temp\pstfiles\PST Export_Export\03.16.2022-1208PM\Exchange' | Select-Object name
$filepath = "C:\temp\ImportPSTMapping.csv"
# Header for CSV file
"Workload,FilePath,Name,Mailbox,IsArchive,TargetRootFolder,ContentCodePage,SPFileContainer,SPManifestContainer,SPSiteUrl" | Out-File -Encoding utf8 -FilePath $filepath
foreach($PSTfile in $PSTfiles){
$mailbox = @()
#First domain is the source domain+.pst
#Seccond domain is the destination domain
$mailbox = (($PSTfile.name).split("-"))[0].Replace("alexholmeset.onmicrosoft.com.pst","M365x04924969.OnMicrosoft.com")
"Exchange,/Exchange,brumunddal@alexholmeset.onmicrosoft.com.pst,brumunddal@M365x04924969.onmicrosoft.com,FALSE,/,,,," | Out-File -Encoding utf8 -FilePath $filepath -Append
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment