Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Search for Inactive User Accounts in Windows Server 2012 Active Directory

$
0
0

Summary: Learn how to use Windows PowerShell to search for inactive user accounts in Active Directory for Windows Server 2012.

Hey, Scripting Guy! Question How can I query inactive user accounts in my Windows Server 2012 Active Directory environment?

Hey, Scripting Guy! Answer Charlotte Windows PowerShell user group member Brian Wilhite says: You can use the ActiveDirectory module that contains the Search-ADAccount cmdlet used to query inactive user and computer accounts. For user accounts only, you’ll use the UsersOnly parameter.

Search-ADAccount -AccountInactive -UsersOnly

You can also use the TimeSpan parameter to specify account inactivity. the example below specifies 30 days of inactivity.

Search-ADAccount -AccountInactive -UsersOnly -TimeSpan 30.00:00:00


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>