Main - Powershell Active Directory Cheat Sheet
Main - Powershell Active Directory Cheat Sheet
Getting Started
Other Cmdlets Recycle Bin User Account Tasks
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
-Identity test.local Users' JoeBloggs Get-ADComputer -Filter 'Name -
like "Server01"'
To change the properties of the Default Domain To create a new group:
Password Policy: To enable a user account:
To create a new computer account:
New-ADGroup -Name "Sales Users" Enable-ADAccount -Identity
Set-ADDefaultDomainPasswordPolicy New-ADComputer -Name "Server01" -
- SamAccountName SalesUsers - JoeBloggs
-Identity test.local - LockoutDuration GroupCategory Security - SamAccountName "Server01" -Path
00:40:00 - GroupScope Global -DisplayName "OU=Computers,OU=Resources,DC=tes
To set the expiration date for a user account:
LockoutObservationWindow 00:20:00 ‘Sales Users’ -Path t,DC=local" -Enabled $true -
-MaxPasswordAge 10.00:00:00 - "OU=Groups,OU=Resources,DC=test, Location "London"
Set-ADAccountExpiration -Identity
MinPasswordLength 8 D C=local" -Description "All JoeBloggs -DateTime "10/18/2008"
Sales Users" To remove a computer account:
To create a new Fine-Grained Password Policy:
To clear the expiration date for a user account: Remove-ADComputer -Identity
New-ADFineGrainedPasswordPolicy - Name To change the properties of a group:
Clear-ADAccountExpiration - "Server01" -Confirm:$false
"Standard Users PSO" - Precedence 500 -
Set-ADGroup -Identity Identity JoeBloggs
ComplexityEnabled
$true -Description "Standard Users 'SalesUsers' -GroupCategory
To change the password for a user account: Organisational Unit Tasks
Password Policy" - DisplayName Distribution -GroupScope
"Standard Users PSO" Universal -ManagedBy To see OU details:
'JoeBloggs' Set-ADAccountPassword -
-LockoutDuration "0.12:00:00" - Identity JoeBloggs -Reset -
LockoutObservationWindow "0.00:15:00" - -Clear Description Get-ADOrganizationalUnit -
NewPassword (ConvertTo- Identity
LockoutThreshold 10 SecureString - AsPlainText
To remove a group: 'OU=Users,OU=Sales,DC=test,DC=loc
"p@ssw0rd" -Force) al'
To see all Fine-Grained Password Policies:
Remove-ADGroup -Identity
To unlock a user account:
Get-ADFineGrainedPasswordPolicy - Filter 'SalesUsers' -Confirm:$false To create a new OU:
{name -like "*"} Unlock-ADAccount -Identity
To see group members: New-ADOrganizationalUnit -Name
JoeBloggs Users -Path
To apply a Fine-Grained Password Policy to a group of
users: Get-ADGroupMember -Identity 'OU=Marketing,DC=test,DC=local'
'SalesUsers' -Recursive
Add-ADFineGrainedPasswordPolicySubject
'Standard Users PSO' -Subjects To add group members:
'Standard Users'
Add-ADGroupMember -Identity
To see which users have been applied to a Fine- 'SalesUsers' -Members
Grained Password Policy: JoeBloggs,SarahJane
Get-ADFineGrainedPasswordPolicySubject
To remove group members:
-Identity 'Standard Users PSO'
Remove-ADGroupMember -Identity
'SalesUsers' -Members
JoeBloggs,SarahJane