Hello
I got the task to extract all the users in our environment for whom last logon and passwordlastset is more than 180 days
Used the below script and got the result
$Days = (get-date).adddays(-180)
Get-ADUser -SearchBase “OU=xxxxx,DC=abc,DC=constoso,DC=net” -filter {lastlogondate -le $days -AND passwordlastset -le $days} -Properties lastlogondate, passwordlastset,Distinguishedname | Select-Object name, lastlogondate, passwordlastset,Distinguishedname
| export-csv test10.csv
However the prob is, it pulling Service account as well, i want only User account.
Can any one help me here
Thanks
NA