$registryPath = "HKCU:\SOFTWARE\Microsoft\Office\Outlook\Addins\SecureSendMail"
if (Test-Path $registryPath) {
Set-ItemProperty -Path $registryPath -Name Loadbehavior -Value "2"
Write-Host "Registry key exists. Loadbehavior set to 2."
} else {
Write-Host "Registry key does not exist"
}
Oneliner:
$registryPath = "HKCU:\SOFTWARE\Microsoft\Office\Outlook\Addins\SecureSendMail"; if (Test-Path $registryPath) {Set-ItemProperty -Path $registryPath -Name Loadbehavior -Value "2"}