You need to grant the following permission to the group Exchange Trusted Subsystem to the network share where you want to export or import PST files:
To import PST files from the share: Read permission
To save exported PST files to the share: Read/Write permission.
#А вообще пароль проще запросить
$cred = get-credential
#и использовать
Import-ExchangeCertificate -FileName "C:\mail\mail.pfx" -Password $cred.Password
Exmerge.EXE:
Verified: Signed
Signing date: 13:16 11.03.2005
Publisher: Microsoft Corporation
Company: Microsoft Corporation
Description: Self-Extracting Cabinet
Product: Microsoftо Windowsо Operating System
Prod version: 5.3.0016.5
File version: 5.3.0016.5 (xpclnt_qfe.020226-1835)
MachineType: 32-bit
Verified: Unsigned
Link date: 11:35 11.03.2005
Publisher: n/a
Company: Microsoft Corporation
Description: Mailbox Merge Program
Product: Microsoft Exchange
Prod version: 6.5
File version: 6.5.7529.0
MachineType: 32-bit
-Features
Centralized: Enables transport servers to handle all message transport between the on-premises Exchange and Exchange Online organizations, including external message delivery to the Internet for both organizations. If this value is $false, the on-premises transport servers and Exchange Online organization are each responsible for their own Internet message delivery.
Get-ExCommand >c:\temp\log
Import-Module "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
#[timezoneinfo]::Utc необходим чтобы при загрузке сообщений не получать ошибку "The specified time zone isn't valid."
$EWS = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService 'Exchange2013',([timezoneinfo]::Utc)
$EWS.AutodiscoverUrl('youremail@example.com')
$email = [Microsoft.Exchange.WebServices.Data.EmailMessage]($EWS)
[void]$email.ToRecipients.Add('someaddress@example.com')
$email.Subject = 'test mail'
$email.Body = 'This is the first email I''ve sent by using the EWS Managed API'
# Enable XML trace
$EWS.TraceEnabled = $true
$EWS.TraceFlags = 'All'
$email.Send()
#$email.SendAndSaveCopy()
# поиск
$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($EWS,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)
$mailitems = $inbox.FindItems(10)
$mailitems | ForEach {$_.Load()}
$mailitems | Select Sender,Subject,Body