your home for end-user virtualization!

Active Directory

List stale Active Directory computer accounts using Windows PowerShell

I was trying to identify computer accounts that had not logged in within the last 6 months. To do that, I used the get-adcomputer PowerShell cmd-let. get-adcomputer -properties lastLogonDate -filter * | where { $_.lastLogonDate -lt (get-date).addmonths(-6) } | FT Name,LastLogonDate > c:\test.txt

Tags: ,

Posted in Active Directory, Microsoft, Powershell | No Comments »

List Active Directory users that have never logged in including built-in users using PowerShell

I was trying to find a way to identify what the unused user accounts were in my AD environment. I started playing with PowerShell’s get-aduser cmd-let. The working script that I came up with is below. get-aduser -f {-not ( lastlogontimestamp -like “*”) -and (enabled -eq $true)} | select name

Tags: ,

Posted in Active Directory, Microsoft, Powershell | No Comments »

Search

Categories