main_powershell-active-directory-cheat-sheet
main_powershell-active-directory-cheat-sheet
Password Policies Group Tasks User Account Security Computer Account Tasks
To see the Default Domain Password Policy: To see group details:
To disable a user account: To see computer account details:
Get-ADDefaultDomainPasswordPolicy Get-ADGroup -Identity 'Sales Disable-ADAccount -Identity Get-ADComputer -Filter 'Name -
-Identity test.local Users' JoeBloggs like "Server01"'
To change the properties of the Default Domain To create a new group: To create a new computer account:
To enable a user account:
Password Policy:
New-ADGroup -Name "Sales Users" - Enable-ADAccount -Identity New-ADComputer -Name "Server01" -
Set-ADDefaultDomainPasswordPolicy SamAccountName "Server01" -Path
SamAccountName SalesUsers - JoeBloggs
-Identity test.local - "OU=Computers,OU=Resources,DC=tes
GroupCategory Security -
LockoutDuration 00:40:00 - To set the expiration date for a user account: t,DC=local" -Enabled $true -
GroupScope Global -DisplayName
LockoutObservationWindow 00:20:00 Location "London"
‘Sales Users’ -Path
-MaxPasswordAge 10.00:00:00 - Set-ADAccountExpiration -Identity
"OU=Groups,OU=Resources,DC=test,D
MinPasswordLength 8 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
$true -Description "Standard 'SalesUsers' -GroupCategory Organisational Unit Tasks
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
To remove a group: AsPlainText "p@ssw0rd" -Force)
"0.00:15:00" -LockoutThreshold 10 '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 Add-ADGroupMember -Identity How to Get More Information
'Standard Users' 'SalesUsers' -Members
Check out the AD PowerShell Blog
JoeBloggs,SarahJane
To see which users have been applied to a Fine-
Grained Password Policy: http://blogs.msdn.com/adpowershell/default.aspx
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