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
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