/ SCRIPTS

Force Outlook Programmatic Access to Enabled via Powershell

A simple script which sets the user specific registry values for enabling programmatic access in Outlook.

Please ensure that you have an up-to-date antivirus installed if you plan to use this, as it weakens security in the Outlook client and is not typically recommended.

The registry keys/values below have worked well consistently on Windows 10 Multi-User (Windows Virtual Desktop) running Microsoft Office 365 Pro Plus.

$userHives = Get-ChildItem "REGISTRY::HKEY_USERS" | Where-Object name  -NotLike "*_Classes" 

# Enumerate each User registry hive and create required registry keys/values
ForEach($hive in $userHives){
    $usersName = Get-ItemProperty "REGISTRY::$($hive.Name)\Volatile Environment\" -Name "Username" | Select-Object USERNAME
    $hivePath = "REGISTRY::$($hive.Name)" # Value will be REGISTRY::HKEY_USERS\(SID)    
    $securityKey = Test-Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\"

    If($securityKey -eq $False){
        Write-Host "Creating Security Key under Office\16.0\Outlook" -ForegroundColor Yellow
        New-Item "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Force
    }

    # All values to create under Outlook security in the current user's hive
    # You will need to change these variables to suit your version of MSOffice
    New-ItemProperty -Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Name “Adminsecuritymode” -Value 3 -PropertyType "DWord" -Force
    New-ItemProperty -Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Name “PromptSimpleMAPISend” -Value 2 -PropertyType "DWord" -Force
    New-ItemProperty -Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Name “PromptSimpleMAPINameResolve” -Value 2 -PropertyType "DWord" -Force
    New-ItemProperty -Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Name “PromptSimpleMAPIOpenMessage” -Value 2 -PropertyType "DWord" -Force
    New-ItemProperty -Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Name “PromptOOMSend” -Value 2 -PropertyType "DWord" -Force
    New-ItemProperty -Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Name “promptoomaddressinformationaccess” -Value 2 -PropertyType "DWord" -Force
    New-ItemProperty -Path "$($hivePath)\Software\Microsoft\Office\16.0\Outlook\Security\" -Name “promptoomaddressbookaccess” -Value 2 -PropertyType "DWord" -Force
}

# Create required machine Wide keys and values
# You will need to change these variables to suit your version of MSOffice
New-Item -path "REGISTRY::HKLM\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Microsoft\Office\16.0\Outlook" -Name "Security" -ErrorAction SilentlyContinue
New-ItemProperty -Path "REGISTRY::HKLM\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Microsoft\Office\16.0\Outlook\Security" -Name “ObjectModelGuard” -Value 2 -PropertyType "DWord" -Force -ErrorAction SilentlyContinue

Download Script (PS1 format)