export office 365 (exchange online) mailbox to local disk with powershell

下载 http://www.messageops.com/software/ exchange migrate


#Egidijus 08-10-2013

#multi PST EXPORT Version 1.0.2

#this script will look read a file on the desktop and then process all the mailboxes in the list

#THIS ONLY EXPORTS MAILBOX, ARCHIVE must be done separately 

#

#this path is mounted to the \\nasbox NAS

$BackupFolderRoot = "u:\data"

#

#this is the list of people to export - email address of mailbox every new line

$Mailboxes = Get-Content "C:\people_to_archive.txt"

 

#Admin Credentials

$creds = Get-Credential

#Get Remote Powershell Connection 

if((Get-PSSession | Where-Object {$_.ConfigurationName -eq "Microsoft.Exchange"}) -eq $null){

$psCred = $creds 

$rpRemotePowershell = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -credential $psCred  -Authentication Basic -AllowRedirection  

$importresults = Import-PSSession $rpRemotePowershell 

}

#Load Migrator PowerShell Module

If (( import-module -Name Messageops-Migrator -ErrorAction SilentlyContinue) -eq $null){

import-module Messageops-Migrator

}

$BackupFolderPath = $BackupFolderRoot + "\" + (Get-Date).ToString("yyyy-MM-dd")

if(!(Test-Path -Path $BackupFolderPath)){

md -Path $BackupFolderPath

}

 

$Mailboxes | ForEach-Object{

Export-MessageOps.ToPST -DestinationDirectory $BackupFolderPath -SourceMailbox  _$ -Credential $creds  -Mailbox

}

Save this script as .ps1 and run it.


你可能感兴趣的:(Exchange,online)