Files
management-scripts/Fix-OfficeModernAuth.ps1
T

9 lines
510 B
PowerShell
Raw Normal View History

$REG_PATH = 'HKCU:\SOFTWARE\Microsoft\Exchange'
$REG_PROP = 'AlwaysUseMSOAuthForAutoDiscover'
2021-03-22 15:42:21 -04:00
If ( !((Get-ItemProperty -Path $REG_PATH -Name $REG_PROP -ErrorAction SilentlyContinue).$REG_PROP) ) {
2023-10-05 13:11:38 -04:00
Write-Output "Adding registry entry: ""${REG_PATH}\${REG_PROP}"" = 1"
2021-03-22 15:42:21 -04:00
Try { New-ItemProperty -Path $REG_PATH -Name $REG_PROP -PropertyType DWord -Value 1 | Out-Null }
2023-10-05 13:17:18 -04:00
Catch { Write-Error $_.Exception.Message }
2021-03-22 15:43:23 -04:00
}
2023-10-05 13:11:38 -04:00
Else { Write-Output "The registry path already exists: ""${REG_PATH}\${REG_PROP}""" }