简体   繁体   中英

Powershell LDAP query to get all groups, owners,members by OU

I need to write a powershell script that will take in an OU and return all the groups and their owners but if no owner then all the members

I have almost 0 powershell knowledge any help would be useful, I do that the active directory module installed

Try this sample:

Import-Module ActiveDirectory ;
Get-ADGroup -Filter {name -like "*Your Group Name*"} -Properties Description,info | Select Name,samaccountname #| Export-Csv D:\output.csv -NoTypeInformation
Get-ADGroupMember YourGroupName # to list members ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM