Active Directory Module

From the official Microsoft docs:

The Active Directory module for Windows PowerShell is a PowerShell module that consolidates a group of cmdlets. You can use these cmdlets to manage your Active Directory domains, Active Directory Lightweight Directory Services (AD LDS) configuration sets, and Active Directory Database Mounting Tool instances in a single, self-contained package.

If you don't have the Active Directory module installed on your machine, you need to download the correct Remote Server Administration Tools (RSAT) package for your OS. Refer to the link below for more information.

The commands utilized are referred to as cmdlets .

Additional resource

AD enumeration

Important option used in the subsequent commands

Note that some of the commands (eg. Get-ADDomain , etc.) may not support all the options listed below. Refer to the respective documentation in the official link above for more information, and this list is provided just for a quick reference

a. -Identity

Specifies an Active Directory user object.

b. -Server

Specifies the Active Directory Domain Services instance to connect to, by providing one of the following values for a corresponding domain name or directory server.

c. -Properties

Specifies the properties of the output object to retrieve from the server.

1. Users

  • -Properties *: to display all the attributes set on the object

2. Groups

-Properties *: to display all the attributes set on the object

Enumerate group membership

3. AD Objects

For a more generic search on any AD objects, we can utilize the Get-ADObject cmdlet.

Examples using Get-ADObject

Useful reference:

  1. Filter by ObjectClass , Name , etc.

ObjectClass

Name

We can even add the -Properties * option to view the full list of properties each object has.

Note that the example outputs shown above simply illustrates a hypothetical example that have been slightly modified based on my experiment on a test AD network.

4. Domains

We can use the Get-ADDomain cmdlet to retrieve more information about a specific domain:

5. Organizational Units (OUs)

Gets one or more Active Directory organizational units.

Eg. Retrieve all OUs:

Examples

  1. Find the value of a property for a user/group

Suppose we want to find the creation date for the group Test Group (Created attribute):

To display only the specified property, along with other default properties (automatically included by the command):

To retrieve the Created attribute only:

Additional options

  1. Select-Object (alias: select)

Eg. with Get-ADUser command:

Last updated