{"id":208573,"date":"2024-01-24T15:29:21","date_gmt":"2024-01-24T15:29:21","guid":{"rendered":"https:\/\/www.ninjaone.com\/script-hub\/authentifizierung-aktiviert-office-365-powershell\/"},"modified":"2024-03-04T18:17:04","modified_gmt":"2024-03-04T18:17:04","slug":"authentifizierung-aktiviert-office-365-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/authentifizierung-aktiviert-office-365-powershell\/","title":{"rendered":"So stellen Sie sicher, dass die moderne Authentifizierung in Office 365 mit PowerShell aktiviert ist"},"content":{"rendered":"<p><a href=\"https:\/\/www.ninjaone.com\/blog\/what-is-modern-authentication\/\">Moderne Authentifizierung<\/a> 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\u00e4rkere Verschl\u00fcsselung und die zus\u00e4tzliche Ebene der Zwei-Faktor-Authentifizierung, was sie zu einem beeindruckenden Verteidigungsmechanismus in der heutigen Cyberlandschaft macht.<\/p>\n<h2>Das Drehbuch verstehen<\/h2>\n<p>Im Kern soll das Skript Klarheit \u00fcber den <strong>Status der modernen Authentifizierung \u00fcber Benutzerprofile hinweg in einer Office 365-Umgebung<\/strong>schaffen. Wie wird dies erreicht? Indem sie jedes Benutzerprofil auf dem Computer sorgf\u00e4ltig durchgehen und die Registrierungswerte f\u00fcr die moderne Authentifizierung untersuchen. Wenn der Wert auf 0 gesetzt wird, ist dies ein deutlicher Hinweis darauf, dass die moderne Authentifizierung f\u00fcr dieses spezifische Benutzerprofil deaktiviert ist.<\/p>\n<h2>Das Skript<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#Requires -Version 5.1\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Monitors if user profiles have modern auth for Office 365 enabled or disabled.\r\n.DESCRIPTION\r\n    Monitors if user profiles have modern auth for Office 365 enabled or disabled.\r\n    Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice15.0CommonIdentityEnableADAL is set to 1.\r\n    Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice16.0CommonIdentityEnableADAL is set to 0.\r\n    Returns an exit code of 1 if one user has modern auth disabled.\r\n    Returns an exit code of 0 if all user have modern auth enabled.\r\n.EXAMPLE\r\n     No parameter needed.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10, Windows Server 2016\r\n    Release Notes:\r\n    Initial Release\r\nBy 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.\r\n    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. \r\n    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. \r\n    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. \r\n    Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, 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. \r\n    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. \r\n    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. \r\n    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam ()\r\n\r\nbegin {\r\n    function Test-IsElevated {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        $p = New-Object System.Security.Principal.WindowsPrincipal($id)\r\n        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)\r\n    }\r\n}\r\nprocess {\r\n    if (-not (Test-IsElevated)) {\r\n        Write-Error -Message \"Access Denied. Please run with Administrator privileges.\"\r\n        exit 1\r\n    }\r\n    # Loop through each user's profile\r\n    # Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice15.0CommonIdentityEnableADAL is set to 1\r\n    # Check if HKEY_CURRENT_USERSOFTWAREMicrosoftOffice16.0CommonIdentityEnableADAL is set to 1\r\n\r\n    $Path = @(\"SOFTWAREMicrosoftOffice15.0CommonIdentity\", \"SOFTWAREMicrosoftOffice16.0CommonIdentity\")\r\n    $Name = \"EnableADAL\"\r\n\r\n    $Script:FoundModernAuthDisabled = $false\r\n\r\n    # Get each user profile SID and Path to the profile\r\n    $UserProfiles = Get-ItemProperty -Path \"HKLM:SOFTWAREMicrosoftWindows NTCurrentVersionProfileList*\" |\r\n        Where-Object { $_.PSChildName -match \"S-1-5-21-(d+-?){4}$\" } |\r\n        Select-Object @{Name = \"SID\"; Expression = { $_.PSChildName } }, @{Name = \"UserHive\"; Expression = { \"$($_.ProfileImagePath)NTuser.dat\" } }, @{Name = \"UserName\"; Expression = { \"$($_.ProfileImagePath | Split-Path -Leaf)\" } }\r\n\r\n    # Loop through each profile on the machine\r\n    Foreach ($UserProfile in $UserProfiles) {\r\n        # Load User ntuser.dat if it's not already loaded\r\n        If (($ProfileWasLoaded = Test-Path -Path \"Registry::HKEY_USERS$($UserProfile.SID)\") -eq $false) {\r\n            Start-Process -FilePath \"cmd.exe\" -ArgumentList \"\/C reg.exe LOAD HKU$($UserProfile.SID) $($UserProfile.UserHive)\" -Wait -WindowStyle Hidden\r\n        }\r\n\r\n        # Read the user's registry\r\n        $Path | ForEach-Object {\r\n            $Key = Join-Path -Path \"Registry::HKEY_USERS$($UserProfile.SID)\" -ChildPath $($_)\r\n            $Value = Get-ItemProperty -Path $Key -ErrorAction SilentlyContinue | Select-Object $Name -ExpandProperty $Name -ErrorAction SilentlyContinue\r\n            if (\r\n                (\r\n                    $_ -like \"*15.0*\" -and\r\n                    $Value -ne 1 -and\r\n                    $(Test-Path -Path $Key -ErrorAction SilentlyContinue)\r\n                ) -or\r\n                (\r\n                    $_ -like \"*16.0*\" -and\r\n                    $Value -eq 0\r\n                )\r\n            ) {\r\n                Write-Host \"$($UserProfile.UserName) ModernAuth is not enabled.\"\r\n                $Script:FoundModernAuthDisabled = $true\r\n            }\r\n        }\r\n \r\n        # Unload NTuser.dat\r\n        If ($ProfileWasLoaded -eq $false) {\r\n            [gc]::Collect()\r\n            Start-Sleep 1\r\n            Start-Process -FilePath \"cmd.exe\" -ArgumentList \"\/C reg.exe UNLOAD HKU$($UserProfile.SID)\" -Wait -WindowStyle Hidden | Out-Null\r\n        }\r\n    }\r\n    if ($FoundModernAuthDisabled) {\r\n        Write-Output $false\r\n        exit 1\r\n    }\r\n    else {\r\n        Write-Output $true\r\n        exit 0\r\n    }\r\n}\r\nend {}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Zugriff auf \u00fcber 300 Skripte im NinjaOne Dojo<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Zugang erhalten<\/a><\/p>\n<\/div>\n<h2>Wie IT-Fachleute davon profitieren k\u00f6nnen<\/h2>\n<p>Das Skript ist nicht nur ein Tool, sondern eine L\u00f6sung, die auf IT-Fachleute zugeschnitten ist. Hier erfahren Sie, wie es zu einer Wende kommen kann:<\/p>\n<ol>\n<li><strong>Proaktive \u00dcberwachung<\/strong>: Das Skript erm\u00f6glicht es IT-Fachleuten, F\u00e4lle zu identifizieren und zu beheben, in denen die moderne Authentifizierung deaktiviert ist, bevor eine potenzielle Sicherheitsl\u00fccke zu einem ausgewachsenen Problem wird.<\/li>\n<li><strong>Effizienz in Bestform<\/strong>: In der IT ist Zeit das A und O. Das Skript automatisiert den sonst m\u00fchsamen Prozess der individuellen \u00dcberpr\u00fcfung jedes Benutzerprofils und spart so wertvolle Zeit.<\/li>\n<li><strong>Klarheit und Orientierung<\/strong>: Kein R\u00e4tselraten mehr. Das Skript gibt klare R\u00fcckmeldungen dar\u00fcber, welche Benutzerprofile Aufmerksamkeit erfordern, und ebnet so den Weg f\u00fcr gezielte und effektive Abhilfema\u00dfnahmen.<\/li>\n<\/ol>\n<h2>NinjaOne: Ihr Partner im IT-Management<\/h2>\n<p>W\u00e4hrend das Skript eine fokussierte L\u00f6sung bietet, erweitert die Integration mit einer <a href=\"https:\/\/www.ninjaone.com\/\">umfassenden IT-Management-Plattform<\/a> wie NinjaOne die M\u00f6glichkeiten. 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\u00fchren. Das Ergebnis? <a href=\"https:\/\/www.ninjaone.com\/endpoint-management\/remote-monitoring-alerting\/\">Echtzeit-Warnungen an IT-Teams<\/a> bei Unstimmigkeiten, um sicherzustellen, dass die Sicherheit nicht beeintr\u00e4chtigt wird.<\/p>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>In der sich st\u00e4ndig 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\u00f6sungen wie NinjaOne k\u00f6nnen IT-Experten ihre Abwehrkr\u00e4fte st\u00e4rken und sicherstellen, dass ihre Unternehmen im Bereich der Cybersicherheit immer einen Schritt voraus sind.<\/p>\n","protected":false},"author":35,"featured_media":207007,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4280],"class_list":["post-208573","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows","use_cases-system-konfiguration"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/208573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/comments?post=208573"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media\/207007"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=208573"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=208573"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=208573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}