Friday 2 August 2013

PowerShell one liners for Active Directory

Just like my PowerCLI one liners post, I am hoping that this one will improve and expand over time.

Get the user "Luke"
Get-ADUser -Filter {SamAccountName -Like 'Luke'}

Get all users with the Surname "Jones"
Get-ADUser -Filter {Surname -like 'Jones'}


Get all disabled users
Get-ADUser -Filter {Enabled -eq 'False'}

Enable a user account
Set-ADUser -Enabled $True -Identity "Luke"

Get members of a group
Get-ADGroupMember esxadmin | Select-Object SamAccountName, Name


No comments:

Post a Comment