githubEdit

Active-Directory-Basic-Command

General Commands

Get-Module

Returns a list of loaded PowerShell Modules.

Get-Command -Module ActiveDirectory 

Lists commands for the module specified.

Get-Help <cmd-let> 

Shows help syntax for the cmd-let specified.

import-Module ActiveDirectory

Imports the Active Directory Module

Active Directory PowerShell Commands

AD User Commands

New-ADUser -Name "first last" -Accountpassword (Read-Host -AsSecureString "Super$ecurePassword!") -Enabled $true -OtherAttributes @{'title'="Analyst";'mail'="f.last@domain.com"}

Add a user to AD and set attributes.

Remove-ADUser -Identity <name>

Removes a user from AD with the identity of 'name'.

Unlock-ADAccount -Identity <name>

Unlocks a user account with the identity of 'name'.

Set the password of an AD user to the password specified.

Force a user to change their password at next logon attempt.

AD Group Commands

Create a new AD OU container named "name" in the path specified.

Create a new security group named "name" with the accompanying attributes.

Add an AD user to the group specified.

GPO Commands

Copy a GPO for use as a new GPO with a target name of "name".

Links an existing GPO to the specified OU path. The "-LinkEnabled Yes" ensures that once the link has been established, that the GPO and it's policies are actually enabled (as it is possibe for a GPLink to exist, but at the same time be disabled.)

Link an existing GPO for use to a specific OU or security group.

Computer Commands

Add a new computer to the domain using the credentials specified.

Remotely add a computer to a domain.

Check for a computer named "name" and view its properties.

Server Operators Group Details

Domain Admins Group Membership

Last updated