0 0

Enable Modern Authentication

Office 365:

if (-not (Get-AppxPackage Microsoft.AAD.BrokerPlugin)) { Add-AppxPackage -Register "$env:windir\SystemApps\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy\Appxmanifest.xml" -DisableDevelopmentMode -ForceApplicationShutdown } Get-AppxPackage Microsoft.AAD.BrokerPlugin

REG ADD "HKCU\Software\Microsoft\Office\16.0\Common\Identity" /v "EnableADAL" /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Office\16.0\Common\Identity" /v "DisableADALatopWAMOverride" /t REG_DWORD /d 1 /f
REG ADD "HKCU\SOFTWARE\Microsoft\Office\15.0\Common\Identity" /v "Version" /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Exchange" /v "AlwaysUseMSOAuthForAutoDiscover" /t REG_DWORD /d 1 /f

https://learn.microsoft.com/nl-nl/microsoft-365/enterprise/modern-auth-for-office-2013-and-2016
https://learn.microsoft.com/nl-nl/microsoft-365/troubleshoot/authentication/automatic-authentication-fails
https://learn.microsoft.com/nl-nl/office/troubleshoot/activation/reset-office-365-proplus-activation-state
$OfficeVersion=reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer"
if ($OfficeVersion -like "*14*") {
# Enable Modern Authentication for Office 2010
REG ADD "HKCU\Software\Microsoft\Office\14.0\Common\Identity" /v "EnableADAL" /t REG_DWORD /d 1 /f
REG ADD "HKCU\SOFTWARE\Microsoft\Office\14.0\Common\Identity" /v "Version" /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Exchange" /v "AlwaysUseMSOAuthForAutoDiscover" /t REG_DWORD /d 1 /f
Write-Host "ADAL enabled for Office 2010"
}
elseif ($OfficeVersion -like "*15*") {
# Enable Modern Authentication for Office 2013
REG ADD "HKCU\Software\Microsoft\Office\15.0\Common\Identity" /v "EnableADAL" /t REG_DWORD /d 1 /f
REG ADD "HKCU\SOFTWARE\Microsoft\Office\15.0\Common\Identity" /v "Version" /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Exchange" /v "AlwaysUseMSOAuthForAutoDiscover" /t REG_DWORD /d 1 /f
Write-Host "ADAL enabled for Office 2013"
}
elseif ($OfficeVersion -like "*16*") {
# Enable Modern Authentication for Office 2016
REG ADD "HKCU\Software\Microsoft\Office\16.0\Common\Identity" /v "EnableADAL" /t REG_DWORD /d 1 /f
REG ADD "HKCU\SOFTWARE\Microsoft\Office\16.0\Common\Identity" /v "Version" /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Exchange" /v "AlwaysUseMSOAuthForAutoDiscover" /t REG_DWORD /d 1 /f
Write-Host "ADAL enabled for Office 2016"
}
else {
Write-Host "nothing to do..."
}

Microsoft account:
if (-not (Get-AppxPackage Microsoft.Windows.CloudExperienceHost)) { Add-AppxPackage -Register "$env:windir\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\Appxmanifest.xml" -DisableDevelopmentMode -ForceApplicationShutdown } Get-AppxPackage Microsoft.Windows.CloudExperienceHost