Server 2012 Active Directory some usefull powershell commands

In a server 2012 we can use powershell for get our works done easily.Im sharing some of them with this article.
1.Search inactive adaccounts with last login date
Search-ADAccount -AccountInactive|fl name,lastlogondate
 

2.Find no of computers using simple powershell commands( i have used one integer variable for get the count)
$intcomcount
$intcomcount=Get-ADComputer -Filter {name -like “*”}
$intcomcount.count
3.Find locked out ad accounts
Search-ADAccount -LockedOut

4.Find the active directory user groups with category and group scope
Get-ADgroup -Filter {name -like “*”}|ft name,groupscope,groupcategory

Leave a Reply