Skip to content

Commit 7d6b15c

Browse files
committed
Extended Azure AD Hybrid Join checks
* Extended Azure AD Hybrid Join checks to include User Device Registration Event Log Invoke-AnalyzeHybridJoinStatus * Check manually defined IE Intranet Sites Invoke-AnalyzeHybridJoinStatus
1 parent 36e89a3 commit 7d6b15c

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

PSModule/ModernWorkplaceClientCenter/Functions/Invoke-AnalyzeHybridJoinStatus.ps1

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function Invoke-AnalyzeHybridJoinStatus {
4848
$scp = New-Object System.DirectoryServices.DirectoryEntry
4949
$scp.Path = "LDAP://CN=62a0ff2e-97b9-4513-943f-0d221bd30080,CN=Device Registration Configuration,CN=Services,CN=Configuration,DC=$getdomaindn";
5050
if ([String]::IsNullOrWhiteSpace($scp.Keywords)) {
51-
$possibleErrors += New-AnalyzeResult -TestName "ADServiceConnectionPoint" -Type Error -Issue "No Service COnnection Point defined in Active Directory." -PossibleCause "Join the device to a domain, otherwise no Hybrid Join will be possible."
51+
$possibleErrors += New-AnalyzeResult -TestName "ADServiceConnectionPoint" -Type Error -Issue "No Service Connection Point defined in Active Directory." -PossibleCause "Join the device to a domain, otherwise no Hybrid Join will be possible."
5252
}
5353
else {
5454
$possibleErrors += New-AnalyzeResult -TestName "ADServiceConnectionPoint" -Type Warning -Issue "Current Value: $($scp.Keywords) `n Validate if the AzureAD GUID and tenant name is correct." -PossibleCause "Sometimes there are incorrect vslues left from a PoC or Testenvironment which can result in an incorrect entriy."
@@ -62,14 +62,22 @@ function Invoke-AnalyzeHybridJoinStatus {
6262

6363
$IESites = Get-SiteToZoneAssignment | Where-Object { ($_.Url -eq "https://autologon.microsoftazuread-sso.com" -or $_.Url -eq "autologon.microsoftazuread-sso.com") -and $_.Zone -eq "Local Intranet Zone" }
6464
if ($null -eq $IESites) {
65-
$possibleErrors += New-AnalyzeResult -TestName "IE Site Assignment" -Type Warning -Issue "We could not detect https://autologon.microsoftazuread-sso.com in the Local Intranet Zone of Internet Explorer." -PossibleCause "One possibility is, that you have configured it manually on this test client in Internet Explorer. This check only validates, if it is assigned through a group policy.
66-
The second option is, that you configured a toplevel site in the intranet site and not especially the above mentioned URL including the protocol."
65+
#Check if it is also not set manually:
66+
$IESitesManual = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\microsoftazuread-sso.com\autologon" -Name https -ErrorAction SilentlyContinue
67+
if($IESitesManual -ne 1){
68+
$possibleErrors += New-AnalyzeResult -TestName "IE Site Assignment" -Type Warning -Issue "We could not detect https://autologon.microsoftazuread-sso.com in the Local Intranet Zone of Internet Explorer." -PossibleCause "One possibility is, that you have configured it manually on this test client in Internet Explorer. This check only validates, if it is assigned through a group policy.
69+
The second option is, that you configured a toplevel site in the intranet site and not especially the above mentioned URL including the protocol."
70+
}
6771
}
6872

6973
$IESites = Get-SiteToZoneAssignment | Where-Object { ($_.Url -eq "https://device.login.microsoftonline.com" -or $_.Url -eq "device.login.microsoftonline.com") -and $_.Zone -eq "Local Intranet Zone" }
7074
if ($null -eq $IESites) {
71-
$possibleErrors += New-AnalyzeResult -TestName "IE Site Assignment" -Type Warning -Issue "We could not detect https://device.login.microsoftonline.com in the Local Intranet Zone of Internet Explorer. To avoid certificate prompts when users in register devices authenticate to Azure AD you can push a policy to your domain-joined devices to add the following URL to the Local Intranet zone in Internet Explorer." -PossibleCause "One possibility is, that you have configured it manually on this test client in Internet Explorer. This check only validates, if it is assigned through a group policy.
72-
The second option is, that you configured a toplevel site in the intranet site and not especially the above mentioned URL including the protocol."
75+
#Check if it is also not set manually:
76+
$IESitesManual = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\microsoftonline.com\device.login" -Name https -ErrorAction SilentlyContinue
77+
if($IESitesManual -ne 1){
78+
$possibleErrors += New-AnalyzeResult -TestName "IE Site Assignment" -Type Warning -Issue "We could not detect https://device.login.microsoftonline.com in the Local Intranet Zone of Internet Explorer. To avoid certificate prompts when users in register devices authenticate to Azure AD you can push a policy to your domain-joined devices to add the following URL to the Local Intranet zone in Internet Explorer." -PossibleCause "One possibility is, that you have configured it manually on this test client in Internet Explorer. This check only validates, if it is assigned through a group policy.
79+
The second option is, that you configured a toplevel site in the intranet site and not especially the above mentioned URL including the protocol."
80+
}
7381
}
7482
# GPO Checks
7583
try {
@@ -118,6 +126,11 @@ function Invoke-AnalyzeHybridJoinStatus {
118126
foreach ($WPJoinEvent in ($WPJoinEvents | Group-Object -Property Id)) {
119127
$possibleErrors += New-AnalyzeResult -TestName "EventLog-WorkplaceJoin" -Type ($WPJoinEvent.Group[0].LevelDisplayName) -Issue "EventId: $($WPJoinEvent.Name)`n$($WPJoinEvent.Group[0].Message)" -PossibleCause ""
120128
}
129+
$UsrDevRegEvents = Get-WinEvent -LogName "Microsoft-Windows-User Device Registration/Admin" | Where-Object { ($_.LevelDisplayName -eq "Error" -or $_.LevelDisplayName -eq "Warning") -and $_.TimeCreated -gt [DateTime]::Now.AddMinutes(-10) }
130+
foreach ($UsrDevRegEvent in ($UsrDevRegEvents | Group-Object -Property Id)) {
131+
$possibleErrors += New-AnalyzeResult -TestName "EventLog-WorkplaceJoin" -Type ($UsrDevRegEvent.Group[0].LevelDisplayName) -Issue "EventId: $($UsrDevRegEvent.Name)`n$($UsrDevRegEvent.Group[0].Message)" -PossibleCause ""
132+
}
133+
121134
}
122135
# Connectifity Tests
123136
$isVerbose = $VerbosePreference -eq 'Continue'
@@ -157,7 +170,7 @@ function Invoke-AnalyzeHybridJoinStatus {
157170

158171
# No errors detected, return success message
159172
if ($possibleErrors.Count -eq 0) {
160-
$possibleErrors += New-AnalyzeResult -TestName "All" -Type Information -Issue "All tests went through successfully." -PossibleCause ""
173+
$possibleErrors += New-AnalyzeResult -TestName "All" -Type Information -Issue "All tests went through successfully. $(if(-not $IncludeEventLog){'You can try to run the command again with the -IncludeEventLog parameter.'})" -PossibleCause ""
161174
}
162175

163176
return $possibleErrors

ReleaseNotes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes
22

3+
## 0.1.10 - Extended Azure AD Hybrid Join checks
4+
5+
* Extended Azure AD Hybrid Join checks to include User Device Registration Event Log Invoke-AnalyzeHybridJoinStatus
6+
* Check manually defined IE Intranet Sites Invoke-AnalyzeHybridJoinStatus
7+
38
## 0.1.9 - Delivery Optimization
49

510
* Improved loading of HttpConnectivtyTester Module

0 commit comments

Comments
 (0)