Any powershell bods here?

Soldato
Joined
18 Oct 2002
Posts
6,372
Location
Bedfordshire
Hi...need a bit of help extracting some info from our AD with QADUser.

I want to compile a list of users which haven't logged on for 60 days which I have found a script for and it works perfectly...

$now=get-date
$daysSinceLastLogon=60

Get-QADUser -sizeLimit 0 | where {
$_.lastlogontimestamp -and
(($now-$_.lastlogontimestamp).days -gt $daysSinceLastLogon)
} | Select-Object Name,sAMAccountName,LastLogonTimeStamp, | export-csv test.csv

My problem is I want to filter out any disabled users with the UserAccountControl attribute, this should be quite an easy thing to do but my powershell is very poor and I am unsure of the syntax?

Many thanks
 
Thank you howler, I have the information I need :)

I think with QADUser I could have used -disabled to get the disabled accounts but I really need to get on a powershell course/book and get up to speed.

Thanks again
 
Back
Top Bottom