PowerShell script to return members of multiple security groups

后端 未结 4 1720
感情败类
感情败类 2021-01-17 21:32

I need to return all members of multiple security groups using PowerShell. Handily, all of the groups start with the same letters.

I can return a list of all the rel

4条回答
  •  清酒与你
    2021-01-17 21:49

    Get-ADGroupMember "Group1" -recursive | Select-Object Name | Export-Csv c:\path\Groups.csv
    

    I got this to work for me... I would assume that you could put "Group1, Group2, etc." or try a wildcard. I did pre-load AD into PowerShell before hand:

    Get-Module -ListAvailable | Import-Module
    

提交回复
热议问题