none
Get Group PowerShell Script for Mulitple Domains with Group Name Filter RRS feed

  • Question

  • Good morning. I am pretty new to PowerShell and most of my experience in Powershell is finding a script analyzing it and adapting to my needs. This request is different and wondering if someone can assist with this request.<o:p></o:p>

    While there are tons of Powershell scripts for find AD Groups and Members, I am looking for one that I could add different attributes and domains to.<o:p></o:p>

    My scenario is that I was asked to provide a list of all groups for a particular application with the application name in the AD group name. Then list all the members of those groups in an Excel spreadsheet.<o:p></o:p>

    The issue is that there are 30+ domains accross the country that I need to comb to find 1000 groups and members.<o:p></o:p>

    I would like to see if I could import a CSV file with all known domains, then GET-ADGroup and filter the name to "OnBase" then export this to an Excel spreadsheet with DN Group Name, Members, and other attributes that I can add to the script.

    Is this easy to do?<o:p></o:p>

    Thanks!<o:p></o:p>


    Friday, April 17, 2015 3:39 PM

Answers

All replies

  • What have you tried?

    -- Bill Stewart [Bill_Stewart]

    Friday, April 17, 2015 5:32 PM
    Moderator
  • Hi Bill.  I tried several scripts online that I found.  The closest I found was:

    Get-ADGroup *    * | Select SamAccountName,Display Name,Description | Export-CSV c:\scripts\groups.csv -NoTypeInformation

    But I am not sure how to import a list of domains to search.  I would like to import a list of domains in either txt or csv format and filter on OnBase, then export that into a CSV for me to manage.  I am looking at 800+ groups with 1000+ users in those groups.

    Thanks!

    Friday, April 17, 2015 6:11 PM
  • You can import a list of domains to search by putting them in a text file and using Get-Content.

    Get-ADGroup has a -SearchBase parameter that lets you retrieve groups starting at the specific path.

    These concepts are basic to PowerShell.

    Start here:

    https://technet.microsoft.com/en-us/scriptcenter/powershell.aspx

    Your learning time investment will pay off in the long run.


    -- Bill Stewart [Bill_Stewart]

    Friday, April 17, 2015 6:17 PM
    Moderator