【问题标题】:Suppress Outlook pop-up allow access禁止 Outlook 弹出窗口允许访问
【发布时间】:2016-07-18 01:24:57
【问题描述】:

运行以下 PowerShell 代码时:

$Outlook = New-Object -ComObject Outlook.Application   
$Stores = $Outlook.Session.Stores 
$Accounts = $Outlook.Session.Accounts
$Accounts | Select-Object DisplayName, UserName, SmtpAddress, ExchangeMailboxServerName, ExchangeMailboxServerVersion

弹出安全警告:

根据Microsoft,有办法解决这个问题。例如,可以Create a COM Add-in for Outlook 而不是使用Outlook COM Object 解释here。自定义 COM Add-in for Outlook 的另一个示例发布在 StackOverflow 上的 here,但用于另一种语言。

使用Globals.ThisAddIn.Application 应该是possible,不是吗?有人可以向我解释这是如何使用 PowerShell 完成的吗?如果我们能避免这个弹出窗口那就太好了,因为它只会让用户感到困惑。

【问题讨论】:

    标签: powershell outlook


    【解决方案1】:

    在运行代码之前通过以本地管理员身份编辑注册表找到workaround

    Function Remove-OutlookSecurityPromptHC {
        [CmdLetBinding()]
        Param()
    
        if (Test-Path -Path 'HKLM:\SOFTWARE\Microsoft\Office\14.0\Outlook') {
            Write-Verbose 'Found MS Outlook 2010'
    
            if (-not (Test-Path -Path 'HKLM:\SOFTWARE\Microsoft\Office\14.0\Outlook\Security')) {
                New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Office\14.0\Outlook\Security' | Out-Null
            }
            Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\14.0\Outlook\Security' -Name ObjectModelGuard -Value 2
            Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\14.0\Outlook\Security' -Name PromptOOMSend -Value 2
            Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\14.0\Outlook\Security' -Name AdminSecurityMode -Value 3
            Write-Verbose 'Outlook warning suppressed'
        }
    
        if (Test-Path -Path 'HKLM:\SOFTWARE\Microsoft\Office\12.0\Outlook') {
            Write-Verbose 'Found MS Outlook 2007'
    
            if (-not (Test-Path -Path 'HKLM:\SOFTWARE\Microsoft\Office\12.0\Outlook\Security')) {
                New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Office\12.0\Outlook\Security' | Out-Null
            }
            Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\12.0\Outlook\Security' -Name ObjectModelGuard -Value 2
            Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\12.0\Outlook\Security' -Name PromptOOMSend -Value 2
            Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Office\12.0\Outlook\Security' -Name AdminSecurityMode -Value 3
            Write-Verbose 'Outlook warning suppressed'
        }
    }
    
    Remove-OutlookSecurityPromptHC -Verbose
    

    运行此代码后,可能需要重新启动/注销才能激活。

    【讨论】:

      【解决方案2】:

      您需要确保计算机上安装了最新的防病毒产品(如果您可以控制客户端环境)或使用RedemptionClickyes 来解决安全提示。详情请见http://www.outlookcode.com/article.aspx?id=52

      【讨论】:

      • 没有 Powershell only(没有第 3 方代码)选项来禁止显示此消息?
      • 很遗憾不是我的朋友,如果你问我,这是一个有点笨拙的设计。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-02
      相关资源
      最近更新 更多