我正在将 PST 提取到 Enterprise Vault 中,但有些失败。在某些情况下,我必须通过在 Outlook 中打开它并将内容导出到新的 PST 文件来重新创建 PST 文件。
可以用powershell做到这一点吗?我正在从现有的 PST 而不是从 Exchnage 创建新的 PST,所以据我所知,new-mailboxexportrequest 不会工作
TIA
安迪
我正在将 PST 提取到 Enterprise Vault 中,但有些失败。在某些情况下,我必须通过在 Outlook 中打开它并将内容导出到新的 PST 文件来重新创建 PST 文件。
可以用powershell做到这一点吗?我正在从现有的 PST 而不是从 Exchnage 创建新的 PST,所以据我所知,new-mailboxexportrequest 不会工作
TIA
安迪
您可以使用Outlook Interop (ComObject)
以编程方式与 Outlook 交互并添加新的 PST 文件存储
之后将旧 PST 中的所有文件夹复制到其中。
我为每个步骤添加了注释,以便您了解它在做什么......
当然,您的工作是检查此过程中丢失物品的可靠性,因此,这里是:
$NewPSTFilePath = "C:\PST\Backup.pst" ## add Your new PST file name path
$outlook = New-Object -ComObject outlook.application
$namespace = $Outlook.GetNameSpace("MAPI")
$OLDStore = $namespace.Stores | Select -First 1 ## get your old PST Store (select the first 1 only)
$NameSpace.AddStore($NewPSTFilePath) ## Add the new PST to the Current profile
$NEWStore = $namespace.Stores | ? {$_.filepath -eq $NewPSTFilePath} ## Get the New Store
$OLDPSTFolders = $OLDStore.GetRootFolder().Folders ## Get the list of folders from the PST
foreach ($folder in $OLDPSTFolders)
{
"Copy $($folder.name)"
[void]$folder.CopyTo($NEWStore)
}
笔记:
该脚本使用您的默认 Outlook 配置文件,要连接到不同的配置文件,请$namespace.Logon("OtherProfileName")
在$namespace = $Outlook.GetNameSpace("MAPI")