禁止 Outlook 弹出窗口允许访问 [英] Suppress Outlook pop-up allow access

查看:47
本文介绍了禁止 Outlook 弹出窗口允许访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行以下 PowerShell 代码时:

When running the following PowerShell code:

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

弹出安全警告:

根据 Microsoft 的说法,有很多方法可以解决这个问题.例如,您可以为 Outlook 创建 COM 加载项,而不是使用 Outlook COM 对象,如此处.此处 在 StackOverflow 上,但适用于另一种语言.

According to Microsoft there are ways around this. For instance, one can Create a COM Add-in for Outlook instead of using the Outlook COM Object as explained here. Another example of a custom COM Add-in for Outlook is posted here on StackOverflow but for another language.

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

Using Globals.ThisAddIn.Application should make this possible, No? Can someone explain to me how this is done with PowerShell? It would be great if we could avoid this pop-up as it will only confuse users.

推荐答案

找到了解决方法 在运行代码之前以本地管理员身份编辑注册表:

Found a workaround by editing the registry as local administrator before running the code:

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

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

After running this code a reboot/logoff might be needed before it becomes active.

这篇关于禁止 Outlook 弹出窗口允许访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆