locked
How to extract the users list via Powershell script RRS feed

  • Question

  • Hi,

    Using powershell script, I want to pull the members of one specific security group/distribution list in excel file.


    Sunday, June 7, 2020 7:15 AM

Answers

  • get-adgroupmember <yourGroup>

    get-adgroupmember xyz > c:\temp\export.csv


    Chris

    • Marked as answer by hashimm Sunday, June 7, 2020 2:36 PM
    Sunday, June 7, 2020 12:46 PM

All replies

  • get-adgroupmember <yourGroup>

    get-adgroupmember xyz > c:\temp\export.csv


    Chris

    • Marked as answer by hashimm Sunday, June 7, 2020 2:36 PM
    Sunday, June 7, 2020 12:46 PM
  • Try this:

    get-adgroupmember |
        Select-Object Name |
            Export-Csv -Path <path-name-here> -NoTypeInformation

    If you want other properties from the results returned by the get-adgroupmember cmdlet, add them to the Select-Object parameter values (e.g. SamAccountName, SID, etc.).

    If the group contains objects other than users (e.g., other groups or computers) you'll have to deal with that. The easiest way to limit the output to only users would be to use a Where-Object between the get-adgroupmember and select-object.


    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    Sunday, June 7, 2020 2:41 PM