Following commands run on a Windows 10 VM that’s joined to AzureAD:
PS C:\Windows\system32> Get-LocalGroupMember -Group Administrators
Get-LocalGroupMember : Failed to compare two elements in the array. At
line:1 char:1PS C:\Windows\system32> Get-LocalGroupMember -Group Users
Group NT AUTHORITY\Authenticated Users Unknown
Group NT AUTHORITY\INTERACTIVE UnknownPS C:\Windows\system32> net localgroup administrators
Members
Administrator AzureAD\UserNameAny idea why the PowerShell Get-LocalGroupMember command is generating an error on the Administrators group whereas net localgroup works as does Get-LocalGroupMember for the Users group?
Answer
This has been referenced as an official bug:
https://github.com/PowerShell/PowerShell/issues/2996
Here is workaround:
http://jdhitsolutions.com/blog/scripting/2342/query-local-administrators-with-cim/
UPDATE:
I had some issues with CIM and WMI.
Here is another workaround which worked everywhere for me.
https://p0w3rsh3ll.wordpress.com/2016/06/14/any-documented-adsi-changes-in-powershell-5-0/
Attribution
Source : Link , Question Author : munrobasher , Answer Author : Luke