Reputation: 993
How can I retrieve the users of a group, if I only have the SID of the group?
I tried several attempts based on this cmd command:
wmic useraccount where name='<username>' get sid
I'm looking for a solution in cmd or Powershell.
Upvotes: 1
Views: 1274
Reputation: 506
Below are some ways to fetch members via SID in PowerShell:
If it is for an AD group, below command should work:
Get-ADGroup S-1-5-32-544 | Get-ADGroupMember
If it is PowserShell version 5.1
Get-LocalGroup -sid S-1-5-32-544 | Get-LocalGroupMember
If it is PowerShell 2.0
(Get-WMIOBject win32_group -Filter "SID='S-1-5-32-544'").GetRelated("Win32_UserAccount")
Upvotes: 2