# Active Directory PowerShell Commands

You can enable Windows PowerShell to execute commands on your Active Directory system. All standard Active Directory commands are supported on your system. For more information on Active Directory PowerShell commands, refer to [ActiveDirectory Module documentation](<https://learn.microsoft.com/en-us/powershell/module/activedirectory/?view=windowsserver2022-ps>).

> [!NOTE]
>
> You can use PowerShell commands to find your configuration information if it's running on a computer connected to the domain.

To get your forest and domain information, complete the following:

1. Select the Windows **Start** button, search for **PowerShell**, and then select **Windows PowerShell**.
2. To view your domain information, enter the following command: `Get-ADDomain`, and then press the **Enter** key.
3. To view your forest information, enter the following command: `Get-ADForest`, and then press the **Enter** key.

## Active Directory Module for Windows PowerShell

To get the closest Domain Controller for a particular domain, the Active Directory source calls IQService.

As a prerequisite, the Active Directory module for Windows PowerShell on the IQService machine must be installed and the Active Directory DS role must be installed on a machine.

To enable the Active Directory module for Windows PowerShell, complete the following:

1. Go to **Server manager \> Features \> Remote Server Administration Tools \> AD DS &amp; LDS tools** and select **Active Directory module for Windows PowerShell**.

To enable the Active Directory module for Windows PowerShell using PowerShell commands, complete the following:

1. Select the Windows **Start** button, search for **PowerShell**, and then select **Windows PowerShell**.
2. In the PowerShell console window, use the `Install-WindowsFeature` cmdlet to install the module. Specify the feature name (`RSAT-AD-PowerShell`) and add the `-IncludeAllSubFeature` parameter to add any child features. For example:

   ```text
   Install-WindowsFeature -Name RSAT-AD-PowerShell -IncludeAllSubFeature
   ```
