Excluding multiple groups from a report in AD using PowerShell


i'm extremely new powershell, , i'm attempting pull list of inactive users, want exclude (currently 6) groups report.i admit mess, it's progress i've made far:

get-aduser -server accounts -filter * -properties samaccountname, description, physicaldeliveryofficename, lastlogontimestamp, passwordlastset, lastlogondate, enabled | where-object {($_.memberof -notcontains "do_not_disable*") -or ($_.memberof -notcontains "pol_xxx") -and ($_.passwordlastset -le $84days) -and ($_.lastlogondate -le $84days) -and ($_.enabled -eq $true)} | select samaccountname, name, description, physicaldeliveryofficename, lastlogontimestamp, passwordlastset, lastlogondate, enabled |sort samaccountname, enabled, name, description, physicaldeliveryofficename, lastlogontimestamp, passwordlastset, lastlogondate, whencreated| export-csv c:\temp\20160216_notgroupmembers1.csv

reason, no matter try exclude these groups, invariably still pop on report. once figure out, using disable users, wanted able @ data, , see pulling information reliably before making changes domain. thank assistance can provided.

also, don't want , groups? want users not members of do_not_disable , not members of pol_xx. if use or users members of 1 not other.

richard mueller - mvp enterprise mobility (identity , access)



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group