【发布时间】:2020-05-28 09:32:58
【问题描述】:
朋友。我想检查我公司每个用户的 Outlook customUI 配置文件。删除 2 个 UI 按钮(如果有)。我正在尝试通过powershell来做到这一点。但未能如愿。对我的脚本有什么建议吗?
以下是 olkexplorer.officeUI 的 XML 内容。我需要检查并删除块引用中的项目,以防它们存在于配置文件中。
<mso:customUI xmlns:x1="Microsoft.Forefront.SpamReporterAddin.Connect" xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui">
<mso:ribbon>
<mso:qat />
<mso:tabs>
<mso:tab idQ="mso:TabMail">
<mso:group id="mso_c1.45620CF" label="Phishing Report" imageMso="TrustCenter" autoScale="true"
<mso:control idQ="x1:ExplorerPhishReportMenuButton" imageMso="TrustCenter" visible="true"/>
</mso:group>
> <mso:group id="mso_c2.14817EBA" label="Junk" autoScale="true">
> <mso:control idQ="x1:ExplorerSpamReportMenuButton" visible="true" />
> <mso:control idQ="x1:ExplorerPhishReportMenuButton" imageMso="GreenBall" visible="true" />
> </mso:group>
</mso:tab>
</mso:tabs>
</mso:ribbon>
</mso:customUI>
这是我的脚本
$input = [xml](Get-Content -Path “$path_to_office\olkexplorer.officeUI”)
$deletenames="mso_c2.14817EBA"
($input.customUI.ChildNodes |Where-object { $deletenames -contains $_.Name}) | ForEach-
Object{[void]$_.ParentNode.RemoveChild($_)}
$input.save(“$path_to_office\new.officeUI”)
【问题讨论】:
-
你的代码的输出是什么?
标签: powershell outlook ribbonx