How to get list Users name who is not part of some Security Groups RRS feed

  • Question

  • How to get a list of Users name who is not part of some Security Groups and I need the Users name to be exported in *CSV format. 

    <g class="gr_ gr_84 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" data-gr-id="84" id="84">Please</g> can anyone let me have the <g class="gr_ gr_78 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="78" id="78">powershell</g> <g class="gr_ gr_85 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" data-gr-id="85" id="85">script ?</g> Thanks in advance

    Thursday, May 3, 2018 1:30 PM

All replies

  • Similar to:

    Get-ADUser -Filter {memberOf -ne "cn=GroupT,ou=Sales,dc=domain,dc=com"} | Select Name, sAMAccountName | Export-Csv .\Users.csv -NoTypeInformation
    You must specify the full distinguished name of the group. I selected sAMAccountName as well as Name, as Name does not uniquely identify users in AD. If you need users not members of multiple groups, then "-AND" or "-OR" more similar clauses in the Filter parameter, according to your intent.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Thursday, May 3, 2018 1:49 PM