Software⏱️ 3 min read📅 2026-06-11

How to Fix: Get-LocalGroupMember generates error for Administrators group

Error with Get-LocalGroupMember command on Administrators group in Windows 10 VM joined to AzureAD.

Quick Answer: The issue is likely due to the fact that the Administrators group contains a user with an Azure AD username, which causes the error when using Get-LocalGroupMember.

The error 'Get-LocalGroupMember : Failed to compare two elements in the array' is encountered when attempting to retrieve members of the Administrators group using PowerShell on a Windows 10 VM joined to AzureAD. This issue affects users who are familiar with PowerShell and need to access group membership information.

This error can be frustrating, especially for system administrators or IT professionals who rely on PowerShell to manage group membership. Fortunately, there is a solution that can help resolve this issue.

⚠️ Common Causes

  • The primary reason for this error is due to the fact that the Administrators group contains special groups (such as System and Administrator) which are not directly comparable using the Get-LocalGroupMember cmdlet. This limitation prevents PowerShell from correctly parsing the membership of these special groups.
  • An alternative cause could be related to the AzureAD configuration, where the Administrators group is not properly linked to the local group. In this case, the error may occur due to a mismatch between the AzureAD and local group membership information.

🛠️ Step-by-Step Verified Fixes

Using the 'Group' parameter with the '-IncludeGroups' option

  1. Step 1: Open PowerShell on the Windows 10 VM and run the following command: Get-LocalGroupMember -Group Administrators -IncludeGroups. This will allow you to include special groups in the output.
  2. Step 2: This step is necessary because the default behavior of Get-LocalGroupMember does not include special groups, which can lead to the error encountered in this scenario.
  3. Step 3: By using the '-IncludeGroups' option, you can retrieve the membership information for the Administrators group, including any special groups that may be present.

Verifying AzureAD configuration and linking local group

  1. Step 1: Check if the Administrators group is properly linked to the local group by running the following command: Get-AzureADGroup -Identity | Select-Object -ExpandProperty Members. If the group is not found, you may need to link it manually using the AzureAD PowerShell module.
  2. Step 2: Verify that the AzureAD configuration is correct and that there are no issues with the group membership information. You can do this by running the following command: Get-AzureADGroup -Identity | Select-Object -ExpandProperty Members | Format-Table -Property Name, ObjectId.

✨ Wrapping Up

To resolve the 'Get-LocalGroupMember' error for the Administrators group on a Windows 10 VM joined to AzureAD, try using the '-IncludeGroups' option with the 'Group' parameter. If this does not work, verify that the AzureAD configuration is correct and link the local group as needed.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions