I got mixed signals when I contacted support about this. To me it was suggested to enable user and group scan in Entra as a solution (though I couldn't understand how that would have fixed the issue).
I hope that Lansweeper acknowledges this issue as something serious. It honestly messes up all your reports and compliancy checks because you cannot distinguish domain joined, Azure AD joined and rogue (workgroup joined) devices.
It is true that WMI does return either the domain or Workgroup. But I guess Lansweeper could work around this by also querying the registry.
I have a PowerShell script where I query WMI and the registry for that info...
# Get the computer system information
$ComputerSystem = Get-WmiObject -Class Win32_ComputerSystem
# Initialize join type and description variables
$JoinType = "Unknown"
$JoinDescription = ""
# Check if the device is part of a domain
if ($ComputerSystem.PartOfDomain) {
# Check the domain role and output the domain name
switch ($ComputerSystem.DomainRole) {
0 {
$JoinType = "Standalone Workstation"
$JoinDescription = "The computer is not connected to a domain and operates as a standalone workstation in a workgroup."
}
1 {
$JoinType = "Member Workstation"
$JoinDescription = "The computer is part of the domain '$($ComputerSystem.Domain)' and operates as a workstation managed by a domain controller."
}
2 {
$JoinType = "Standalone Server"
$JoinDescription = "The computer is a standalone server, not part of a domain."
}
3 {
$JoinType = "Member Server"
$JoinDescription = "The computer is part of the domain '$($ComputerSystem.Domain)' and operates as a server managed by a domain controller."
}
4 {
$JoinType = "Backup Domain Controller"
$JoinDescription = "The computer is a backup domain controller in the domain '$($ComputerSystem.Domain)'. It helps manage domain authentication and services."
}
5 {
$JoinType = "Primary Domain Controller"
$JoinDescription = "The computer is the primary domain controller in the domain '$($ComputerSystem.Domain)'. It is responsible for managing domain resources, authentication, and policies."
}
}
}
else {
# Check if the device is Azure AD joined by querying the correct registry key
$RegistryPath = "HKLM:\SOFTWARE\Microsoft\Enrollments"
$Enrollments = Get-ChildItem -Path $RegistryPath -ErrorAction SilentlyContinue
$AzureADJoined = $false
foreach ($Enrollment in $Enrollments) {
$EnrollmentPath = $Enrollment.PSPath
$JoinTypeKey = Get-ItemProperty -Path $EnrollmentPath -ErrorAction SilentlyContinue
# Check if the enrollment is related to Azure AD
if ($JoinTypeKey -and $JoinTypeKey.AADTenantID -ne $null) {
$AzureADJoined = $true
break
}
}
# Set the join type based on the registry check
if ($AzureADJoined) {
$JoinType = "Azure AD Joined"
$JoinDescription = "The device is joined to Azure Active Directory."
}
else {
# If not Azure AD joined, assume it's a Workgroup device
$JoinType = "Workgroup"
$JoinDescription = "The computer is not part of a domain or Azure AD, and is in a workgroup."
}
}
# Output the join type and description
$JoinType
$JoinDescription
__PRESENT