Demo ansehen×
×

Sehen Sie NinjaOne in Aktion!

Mit dem Absenden dieses Formulars akzeptiere ich die Datenschutzerklärung von NinjaOne.

So stellen Sie sicher, dass die moderne Authentifizierung in Office 365 mit PowerShell aktiviert ist

Moderne Authentifizierung ist eine Sicherheitsfunktion in Office 365, die Azure Active Directory (AAD) zur Authentifizierung von Benutzer:innen verwendet. Sie steht als Leuchtturm der Sicherheit im Schatten traditioneller Authentifizierungsmethoden wie der Basisauthentifizierung. Der Grund? Die moderne Authentifizierung verwendet eine stärkere Verschlüsselung und die zusätzliche Ebene der Zwei-Faktor-Authentifizierung, was sie zu einem beeindruckenden Verteidigungsmechanismus in der heutigen Cyberlandschaft macht.

Das Drehbuch verstehen

Im Kern soll das Skript Klarheit über den Status der modernen Authentifizierung über Benutzerprofile hinweg in einer Office 365-Umgebungschaffen. Wie wird dies erreicht? Indem sie jedes Benutzerprofil auf dem Computer sorgfältig durchgehen und die Registrierungswerte für die moderne Authentifizierung untersuchen. Wenn der Wert auf 0 gesetzt wird, ist dies ein deutlicher Hinweis darauf, dass die moderne Authentifizierung für dieses spezifische Benutzerprofil deaktiviert ist.

Das Skript

#Requires -Version 5.1

<#
.SYNOPSIS
    Monitors if user profiles have modern auth for Office 365 enabled or disabled.
.DESCRIPTION
    Monitors if user profiles have modern auth for Office 365 enabled or disabled.
    Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice15.0CommonIdentityEnableADAL is set to 1.
    Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice16.0CommonIdentityEnableADAL is set to 0.
    Returns an exit code of 1 if one user has modern auth disabled.
    Returns an exit code of 0 if all user have modern auth enabled.
.EXAMPLE
     No parameter needed.
.OUTPUTS
    None
.NOTES
    Minimum OS Architecture Supported: Windows 10, Windows Server 2016
    Release Notes:
    Initial Release
By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https://www.ninjaone.com/terms-of-use.
    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. 
    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. 
    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. 
    Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. 
    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. 
    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. 
    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).
#>

[CmdletBinding()]
param ()

begin {
    function Test-IsElevated {
        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
        $p = New-Object System.Security.Principal.WindowsPrincipal($id)
        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
    }
}
process {
    if (-not (Test-IsElevated)) {
        Write-Error -Message "Access Denied. Please run with Administrator privileges."
        exit 1
    }
    # Loop through each user's profile
    # Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice15.0CommonIdentityEnableADAL is set to 1
    # Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice16.0CommonIdentityEnableADAL is set to 1

    $Path = @("SOFTWAREMicrosoftOffice15.0CommonIdentity", "SOFTWAREMicrosoftOffice16.0CommonIdentity")
    $Name = "EnableADAL"

    $Script:FoundModernAuthDisabled = $false

    # Get each user profile SID and Path to the profile
    $UserProfiles = Get-ItemProperty -Path "HKLM:SOFTWAREMicrosoftWindows NTCurrentVersionProfileList*" |
        Where-Object { $_.PSChildName -match "S-1-5-21-(d+-?){4}$" } |
        Select-Object @{Name = "SID"; Expression = { $_.PSChildName } }, @{Name = "UserHive"; Expression = { "$($_.ProfileImagePath)NTuser.dat" } }, @{Name = "UserName"; Expression = { "$($_.ProfileImagePath | Split-Path -Leaf)" } }

    # Loop through each profile on the machine
    Foreach ($UserProfile in $UserProfiles) {
        # Load User ntuser.dat if it's not already loaded
        If (($ProfileWasLoaded = Test-Path -Path "Registry::HKEY_USERS$($UserProfile.SID)") -eq $false) {
            Start-Process -FilePath "cmd.exe" -ArgumentList "/C reg.exe LOAD HKU$($UserProfile.SID) $($UserProfile.UserHive)" -Wait -WindowStyle Hidden
        }

        # Read the user's registry
        $Path | ForEach-Object {
            $Key = Join-Path -Path "Registry::HKEY_USERS$($UserProfile.SID)" -ChildPath $($_)
            $Value = Get-ItemProperty -Path $Key -ErrorAction SilentlyContinue | Select-Object $Name -ExpandProperty $Name -ErrorAction SilentlyContinue
            if (
                (
                    $_ -like "*15.0*" -and
                    $Value -ne 1 -and
                    $(Test-Path -Path $Key -ErrorAction SilentlyContinue)
                ) -or
                (
                    $_ -like "*16.0*" -and
                    $Value -eq 0
                )
            ) {
                Write-Host "$($UserProfile.UserName) ModernAuth is not enabled."
                $Script:FoundModernAuthDisabled = $true
            }
        }
 
        # Unload NTuser.dat
        If ($ProfileWasLoaded -eq $false) {
            [gc]::Collect()
            Start-Sleep 1
            Start-Process -FilePath "cmd.exe" -ArgumentList "/C reg.exe UNLOAD HKU$($UserProfile.SID)" -Wait -WindowStyle Hidden | Out-Null
        }
    }
    if ($FoundModernAuthDisabled) {
        Write-Output $false
        exit 1
    }
    else {
        Write-Output $true
        exit 0
    }
}
end {}

 

Zugriff auf über 300 Skripte im NinjaOne Dojo

Zugang erhalten

Wie IT-Fachleute davon profitieren können

Das Skript ist nicht nur ein Tool, sondern eine Lösung, die auf IT-Fachleute zugeschnitten ist. Hier erfahren Sie, wie es zu einer Wende kommen kann:

  1. Proaktive Überwachung: Das Skript ermöglicht es IT-Fachleuten, Fälle zu identifizieren und zu beheben, in denen die moderne Authentifizierung deaktiviert ist, bevor eine potenzielle Sicherheitslücke zu einem ausgewachsenen Problem wird.
  2. Effizienz in Bestform: In der IT ist Zeit das A und O. Das Skript automatisiert den sonst mühsamen Prozess der individuellen Überprüfung jedes Benutzerprofils und spart so wertvolle Zeit.
  3. Klarheit und Orientierung: Kein Rätselraten mehr. Das Skript gibt klare Rückmeldungen darüber, welche Benutzerprofile Aufmerksamkeit erfordern, und ebnet so den Weg für gezielte und effektive Abhilfemaßnahmen.

NinjaOne: Ihr Partner im IT-Management

Während das Skript eine fokussierte Lösung bietet, erweitert die Integration mit einer umfassenden IT-Management-Plattform wie NinjaOne die Möglichkeiten. NinjaOne bietet eine einheitliche Plattform, die den IT-Betrieb vereinfacht. Wenn es um die moderne Authentifizierung in Office 365 geht, kann NinjaOne das Skript nahtlos in geplanten Intervallen ausführen. Das Ergebnis? Echtzeit-Warnungen an IT-Teams bei Unstimmigkeiten, um sicherzustellen, dass die Sicherheit nicht beeinträchtigt wird.

Abschließende Überlegungen

In der sich ständig weiterentwickelnden IT-Welt ist die moderne Authentifizierung in Office 365 nicht nur eine Funktion, sondern eine Notwendigkeit. Durch den Einsatz des besprochenen Skripts und die Integration mit robusten Lösungen wie NinjaOne können IT-Experten ihre Abwehrkräfte stärken und sicherstellen, dass ihre Unternehmen im Bereich der Cybersicherheit immer einen Schritt voraus sind.

Nächste Schritte

Der Aufbau eines effizienten und effektiven IT-Teams erfordert eine zentralisierte Lösung, die als vereintes Tool für die Bereitstellung von Dienstleistungen fungiert. NinjaOne ermöglicht es IT-Teams, all ihre Geräte zu überwachen, verwalten, sichern und zu unterstützen, unabhängig von ihrem Ort und komplexer Infrastruktur vor Ort.

Erfahren Sie mehr über NinjaOne Endpoint Management schauen Sie sich eine Live-Tour an oder starten Sie Ihre kostenlose Testversion der NinjaOne Plattform.

Kategorien:

Das könnte Sie auch interessieren

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).