locked
Report for the users they are not a member of location groups RRS feed

  • Question

  • We are doing a clean-up in AD.  I would like generate a report that the user they are not a member of location groups

    User                Memberof AD Group

    Test1               _Uk

    Test2               _APAC

    Test3               _EMEA

    Test4               Not a member

    From the above example, test1-3 are a member of location groups but test4 is not. I would like generate a report that the user they are not a member of location groups (like test4).

    Please note that the groups are not unique. Can anyone please help?

    i tried this script, this will list all the groups the user is a member of. but how can i find if the users they are not a member of location groups?

    import-csv "" |%{Get-ADUser -identity $_.samaccountname -Server Servername  -properties * | select displayname, Department,EmailAddress, Enabled,office,@{Name="GroupsMembership";Expression={[string]::Join(';',(Get-ADPrincipalGroupMembership -Identity $_ | select -ExpandProperty name))}} | Export-Csv "C:\Users\ADUsers.csv" -Append -NoTypeInformation}

    • Edited by AustinSundar Tuesday, July 14, 2020 6:48 AM additional details
    Tuesday, July 14, 2020 6:32 AM

All replies