Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

List users in OU - Not Expired and Not Enabled

$
0
0

Hi

I am currently doing a full audit on our AD environment and need reporting back all user accounts that are live within each site OU we have, that meet the following criteria

-Not Disabled
-Not Expired
-User has logged on in the past 90 days

So far i have the following but only shows users that have accounts Enabled in the SITEA ou, i am struggling to add the logged on in last 90 days and account has not expired syntax

Get-ADUser -SearchBase "OU=SITEA,DC=MY,DC=COMPANY,DC=CO,DC=UK" -Filter * |where { $_.enabled -eq $false}| Sort-Object name | select name | Export-Csv 'c:\scripts\sitea.csv'

Any help would be appreciated

Barrie


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>