导出到邮箱.PST

这个简单的脚本会提示输入目标邮箱、 获得当前用户、 将所需的权限应用到目标邮箱和邮箱导出到 PST 文件。
powershell
$TargetUserName = Read-Host “Enter the user you would like to Export”
$TargetArchiveDir = Get-Item “\\FILE-SERVER\ARCHIVE PST\”
$CurrentHostName = hostname
$CurrentProfile = Gwmi Win32_ComputerSystem -Comp $CurrentHostName
“Logged On As User: ” + $CurrentProfile.UserName

Write-Host “Setting Permissions” -ForeGroundColor Yellow
Add-MailboxPermission -Identity $TargetUserName -User $CurrentProfile.Username -AccessRights ‘FullAccess’

Write-Host “Exporting Mailbox” -ForeGroundColor Yellow
Export-Mailbox -identity $TargetuserName -PSTFolderPath $TargetArchiveDir -Confirm:$True
Write-Host “You can now Delete the user – I’m too scared to do it for you!” -ForeGroundColor Yellow

发布于: 浏览:2326 次

还没有评论

欢迎参与到我们的技术讨论,问题和分享都可以。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据