locked
USing active directory to get user & group information RRS feed

  • General discussion

  • Hello,

    I have been working on a script which pulls all active directory user informations  (Such as Displayname, title, Department, memberof).

    Here is the script:

    Import-Module ActiveDirectory
    Get-ADUser -Filter  "enabled -eq 'true'" -Properties DisplayName,Title,Department,memberof | % {
      New-Object PSObject -Property @{
        UserName = $_.DisplayName
        JobTitle = $_.Title
        Department = $_.Department
        Groups = ($_.memberof | Get-ADGroup | Select -ExpandProperty Name) -join ","
        }
    } | Select UserName,JobTitle,Department,Groups | Export-Csv U:\audit2.csv -NTI

    The script functions properly. My issue is this, I wish to baseline each departments group memberships, and the baseline group memberships defined by the title. So it can be determined, that such asnd such department, belongs to these groups by default, and this role adds these additional memberships.

    Would i be able to append the script to do this as well, or import the script to do this. Or do i need to do this in excel?

    Thanks for any help.

    • Changed type Bill_Stewart Monday, March 19, 2018 5:40 PM
    • Moved by Bill_Stewart Monday, March 19, 2018 5:40 PM Unanswerable drive-by question
    Thursday, February 15, 2018 7:23 PM

All replies

  • What does "baseline each departments [sic] group memberships" mean?

    I don't think we can answer organization-specific questions for you from afar in a forum.


    -- Bill Stewart [Bill_Stewart]

    Thursday, February 15, 2018 7:28 PM
  • If the CSV has everything you need, it would be easy to read it into Excel, where you can filter and sort, and even lookup values from a table on another tab.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Thursday, February 15, 2018 9:03 PM