Get-LocalGroupMember generates error for Administrators group

munrobasher

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:1

PS C:\Windows\system32> Get-LocalGroupMember -Group Users
Group NT AUTHORITY\Authenticated Users Unknown
Group NT AUTHORITY\INTERACTIVE Unknown

PS C:\Windows\system32> net localgroup administrators
Members
Administrator AzureAD\UserName

Any 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?

Luke

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/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Adding group to local administrators

From Dev

Powershell Get-SCVirtualDiskDrive generates a Common Language Specification (CLR) error

From Dev

Powershell Get-SCVirtualDiskDrive generates a Common Language Specification (CLR) error

From Dev

Group by generates a huge query

From Dev

How to determine if an account belongs to Administrators group programmatically?

From Dev

Plugin for creating a group of administrators in Liferay 7

From Dev

cygwin: Administrator user not a member of Administrators group

From Dev

Powershell; Delete users from computer by Get-LocalGroupMember

From Dev

CascadeClassifier in OpenCV generates error

From Dev

Passbook generates PKPass error

From Dev

randomString Function Generates error?

From Dev

GROUP BY HAVING NOT generates wrong result

From Dev

Do high-integrity tokens *have* to have the Administrators group enabled?

From Dev

SID for Administrators group doesn't show in a member account

From Dev

Create windows user with chef and add user to the local Administrators group

From Dev

Access denied adding domain user to local administrators group

From Dev

How to add a domain user to Administrators group in Windows 10

From Dev

Add domain group to local computer administrators command line

From Dev

Laravel PHP 4: Trying to delete 'null' photo generates 'Trying to get property of non-object' error

From Dev

Setting a delegate generates a compile error

From Dev

UISwitch in static UITableViewCell generates error

From Dev

Executing :mksession in vim generates error

From Dev

DOTS Task Generates error on load

From Dev

Pepper Robot - getImageLocal generates error

From Dev

HttpClient POST generates GET instead

From Dev

pandas get_group causes memory error

From Dev

Node.js https.get via proxy generates SSL3_GET_RECORD wrong version number error

From Dev

why my account in administrators group can not access an asp.net page after i have allowed access only to administrators

From Dev

gst regular expression mismatch of group generates exception

Related Related

  1. 1

    Adding group to local administrators

  2. 2

    Powershell Get-SCVirtualDiskDrive generates a Common Language Specification (CLR) error

  3. 3

    Powershell Get-SCVirtualDiskDrive generates a Common Language Specification (CLR) error

  4. 4

    Group by generates a huge query

  5. 5

    How to determine if an account belongs to Administrators group programmatically?

  6. 6

    Plugin for creating a group of administrators in Liferay 7

  7. 7

    cygwin: Administrator user not a member of Administrators group

  8. 8

    Powershell; Delete users from computer by Get-LocalGroupMember

  9. 9

    CascadeClassifier in OpenCV generates error

  10. 10

    Passbook generates PKPass error

  11. 11

    randomString Function Generates error?

  12. 12

    GROUP BY HAVING NOT generates wrong result

  13. 13

    Do high-integrity tokens *have* to have the Administrators group enabled?

  14. 14

    SID for Administrators group doesn't show in a member account

  15. 15

    Create windows user with chef and add user to the local Administrators group

  16. 16

    Access denied adding domain user to local administrators group

  17. 17

    How to add a domain user to Administrators group in Windows 10

  18. 18

    Add domain group to local computer administrators command line

  19. 19

    Laravel PHP 4: Trying to delete 'null' photo generates 'Trying to get property of non-object' error

  20. 20

    Setting a delegate generates a compile error

  21. 21

    UISwitch in static UITableViewCell generates error

  22. 22

    Executing :mksession in vim generates error

  23. 23

    DOTS Task Generates error on load

  24. 24

    Pepper Robot - getImageLocal generates error

  25. 25

    HttpClient POST generates GET instead

  26. 26

    pandas get_group causes memory error

  27. 27

    Node.js https.get via proxy generates SSL3_GET_RECORD wrong version number error

  28. 28

    why my account in administrators group can not access an asp.net page after i have allowed access only to administrators

  29. 29

    gst regular expression mismatch of group generates exception

HotTag

Archive