ADPowerShell QuickReference
ADPowerShell QuickReference
Password Policies Group Tasks User Account Security Computer Account Tasks
sks
To see the Default Domain Password Policy: To see group details: To disable a user account: To see computer account details:
To change the properties of the Default Domain To create a new group: To enable a user account: To create a new computer account:
Password Policy:
Enable-ADAccount -Identity New-ADComputer -Name "Server01" -
Set-ADDefaultDomainPasswordPolicy New-ADGroup -Name "Sales Users" -
JoeBloggs SamAccountName "Server01" -Path
-Identity test.local - SamAccountName SalesUsers -
"OU=Computers,OU=Resources,DC=tes
LockoutDuration 00:40:00 - GroupCategory Security -
To set the expiration date for a user account: t,DC=local" -Enabled $true -
LockoutObservationWindow 00:20:00 GroupScope Global -DisplayName
Location "London"
-MaxPasswordAge 10.00:00:00 - ‘Sales Users’ -Path
Set-ADAccountExpiration -Identity
MinPasswordLength 8 "OU=Groups,OU=Resources,DC=test,D
JoeBloggs -DateTime "10/18/2008" To remove a computer account:
C=local" -Description "All Sales
To create a new Fine-Grained Password Policy: Users" To clear the expiration date for a user account: Remove-ADComputer -Identity
"Server01" -Confirm:$false
New-ADFineGrainedPasswordPolicy - To change the properties of a group: Clear-ADAccountExpiration -
Name "Standard Users PSO" - Identity JoeBloggs
Precedence 500 -ComplexityEnabled Set-ADGroup -Identity
Organisational Unit Tasks
$true -Description "Standard 'SalesUsers' -GroupCategory To change the password for a user account:
Users Password Policy" - Distribution -GroupScope To see OU details:
DisplayName "Standard Users PSO" Universal -ManagedBy 'JoeBloggs' Set-ADAccountPassword -Identity
-LockoutDuration "0.12:00:00" - -Clear Description JoeBloggs -Reset -NewPassword Get-ADOrganizationalUnit -
LockoutObservationWindow (ConvertTo-SecureString - Identity
"0.00:15:00" -LockoutThreshold 10 To remove a group: AsPlainText "p@ssw0rd" -Force) 'OU=Users,OU=Sales,DC=test,DC=loc
al'
To see all Fine-Grained Password Policies: Remove-ADGroup -Identity To unlock a user account:
'SalesUsers' -Confirm:$false To create a new OU:
Get-ADFineGrainedPasswordPolicy - Unlock-ADAccount -Identity
Filter {name -like "*"} To see group members: JoeBloggs New-ADOrganizationalUnit -Name
Users -Path
To apply a Fine-Grained Password Policy to a group Get-ADGroupMember -Identity 'OU=Marketing,DC=test,DC=local'
of users: 'SalesUsers' -Recursive
Add- To add group members:
ADFineGrainedPasswordPolicySubjec
t 'Standard Users PSO' -Subjects How to Get More Information
Add-ADGroupMember -Identity
'Standard Users' 'SalesUsers' -Members Check out the AD PowerShell Blog
JoeBloggs,SarahJane
To see which users have been applied to a Fine- http://blogs.msdn.com/adpowershell/default.aspx
Grained Password Policy:
To remove group members:
Make sure you visit the following sites for PowerShell Podcasts
Get- For the latest version of this doc check
ADFineGrainedPasswordPolicySubjec Remove-ADGroupMember -Identity http://get-scripting.blogspot.com/
t -Identity 'Standard Users PSO' 'SalesUsers' -Members http://powerscripting.net/ http://jonathanmedd.net
JoeBloggs,SarahJane v0.1