Find Disabled and Inactive User and Computer Accounts using Powershell - Part II

March 25, 2008

Part I demonstrated how to find aged or inactive accounts, and in Part II we will look at another lingering account type: disabled accounts. Like inactive accounts, Directory Searchers also come in handy for disabled accounts. We can also, however, read an Active Directory account’s status directly from a hidden attribute on the ADSI object. Let’s start with the Directory Searcher method. This entry also draws from Bahram’s Blog. The code: ... Read more

Find Disabled and Inactive User and Computer Accounts using Powershell - Part I

March 25, 2008

We’ll start off with Inactive accounts first, and then work on the disabled accounts after that. Active Directory in Server 2003 has a nice user/computer attribute called lastLogonTimeStamp that can help us keep track of inactive accounts. If you have ever tried to use that attribute, however, you might have come up with something like this… PoSH> $struserdn = "CN=Some User,OU=Users,OU=Corp,DC=yourdomain,DC=local" PoSH> $adobjuser = [ADSI]"LDAP://$struserdn" PoSH> $adobjuser {CN=Some User,OU=Users,OU=Corp,DC=yourdomain,DC=local} PoSH> $adobjuser. ... Read more

© 2017 Hugo Slabbert. Some rights reserved. Please attribute properly and link back.