From da1479b96b23d48dbaf734c9404b1b6505db859f Mon Sep 17 00:00:00 2001 From: dyoder Date: Mon, 22 Mar 2021 15:42:21 -0400 Subject: [PATCH] silence script output --- Fix-OfficeModernAuth.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Fix-OfficeModernAuth.ps1 b/Fix-OfficeModernAuth.ps1 index c5efd06..9f61caa 100644 --- a/Fix-OfficeModernAuth.ps1 +++ b/Fix-OfficeModernAuth.ps1 @@ -1,7 +1,7 @@ $REG_PATH = 'HKCU:\SOFTWARE\Microsoft\Exchange' $REG_PROP = 'AlwaysUseMSOAuthForAutoDiscover' -If ( !((Get-ItemProperty -Path $REG_PATH -Name $REG_PROP).$REG_PROP) ) { +If ( !((Get-ItemProperty -Path $REG_PATH -Name $REG_PROP -ErrorAction SilentlyContinue).$REG_PROP) ) { LogMsg "Adding registry entry: ""${REG_PATH}\${REG_PROP}"" = 1" - Try { New-ItemProperty -Path $REG_PATH -Name $REG_PROP -PropertyType DWord -Value 1 } + Try { New-ItemProperty -Path $REG_PATH -Name $REG_PROP -PropertyType DWord -Value 1 | Out-Null } Catch { LogErr $_.Exception.Message } } \ No newline at end of file