我正在尝试运行以下PowerShell脚本。它应该从提到的目录中连接Microsoft Outlook中的所有pst文件:
Add-Type -Assembly "Microsoft.Office.Interop.Outlook" | Out-Null
$Outlook = New-Object -ComObject Outlook.Application
$Namespace = $outlook.GetNameSpace("MAPI")
Dir "C:\Users\bob\Documents\Outlook Files\* .pst" | % {$Namespace.AddStore($ _. FullName)}
我收到以下错误消息:
提前感谢大家的贡献。
P.S。下面的文本中的错误消息。我最初没有把它包括在内,因为我认为它很草率,难以阅读。
At line:4 char:80 + Dir 'C:\Users\bob\Documents\Outlook Files\* .pst' | % {$Namespace.AddStore($ ... + ~ Missing ')' in method call. At line:4 char:80 + Dir 'C:\Users\bob\Documents\Outlook Files\* .pst' | % {$Namespace.AddStore($ ... + ~ Unexpected token '$' in expression or statement. At line:4 char:59 + Dir 'C:\Users\bob\Documents\Outlook Files\* .pst' | % {$Namespace.AddStore($ ... + ~ Missing closing '}' in statement block. At line:4 char:93 + ... e($ _. FullName)} + ~ Unexpected token ')' in expression or statement. At line:4 char:94 + ... ($ _. FullName)} + ~ Unexpected token '}' in expression or statement. At line:4 char:80 + Dir 'C:\Users\bob\Documents\Outlook Files\* .pst' | % {$Namespace.AddStore($ ... + ~ + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall