четверг, 7 января 2021 г.

Export PST from Exchange2010 - PowerShell

 cls

<# PST Export from Exchange2010 with PowerShell #
Use on Exchange2010 or workstation with Exchange2010 tools installed #>

Set-ExecutionPolicy Bypass -force

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://Exchange2010.Domain.local/PowerShell/ -Authentication Kerberos -Credential $UserCredential

Import-PSSession $Session

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

# Add-ADGroupMember Administrators -Members "Exchange Trusted Subsystem"

# New-RoleGroup -Name “Exchange Mailbox Import Export” -Roles “Mailbox Import Export” -Members "Domain\Administrators" -Display Name”Exchange Mailbox Import Export”

$Mailbox = ""

$PSTname = ""

$DirPath = ""

$JoinedPath = ""

$Mailbox = "User@milgam.co.il"

$PSTname = "$Mailbox.pst"

$DirPath = "\\X.X.X.X\$Mailbox\"

$FilePath = Join-Path $DirPath -ChildPath $PSTname

# New-Item -ItemType Directory -Path $DirPath # (= MD $PSTPath)

ii $DirPath

New-MailboxExportRequest -Mailbox $Mailbox -FilePath $FilePath

# Get-MailboxExportRequest -status Completed | Remove-MailboxExportRequest # for clearing purposes

<#

If you get error "New-MailboxExportRequest : Unable to open PST file" you can give the
COMPUTER that you run this script from write permissions on the share/folder $DirPath.
Also it may be lack of permissions for "Exchange Trusted Subsystem".
#>


Комментариев нет:

Отправить комментарий