Windows – Enabling Active Directory Module for PowerShell via command line

active-directorycommand linepowershellwindows 7

As a final step in my Win7 MDT task sequence, I would like to move each computer from the staging OU to the regular OU (so GPO's can be pushed). My deployment techs have proven less than reliable on manually moving them, so I thought to automate the process using PowerShell. In the task sequence, I can install RSAT via command line, and the next step is to enable that specific feature using dism:

dism /online /enable-feature /featurename:RemoteServerAdministrationTools-<featurename>

Then I run the PS script, disable it via dism, and uninstall RSAT with the same method. However, I cannot seem to find the feature name for the PowerShell module, as seen in this screenshot:

Active Directory Module for Windows PowerShell

I have searched all through Google and Technet, to no avail. I literally only need the PS module. I have tried to just copy the module folder, but when trying to import the module in my script, it tells me the assembly 'microsoft.activedirectory.management' was not loaded because no assembly was found, which means the assembly dll is buried somewhere in the RSAT installation.

If you have any other suggestions on how to import that module without installing RSAT, I would actually prefer that, but nothing I have found thus far works.

Thanks in advance.

Best Answer

The feature name is RemoteServerAdministrationTools-Roles-AD-Powershell

For future reference, dism will list all available features with the /get-features switch:

dism /online /get-features

Or with PowerShell:

Get-WindowsOptionalFeature -Online
Related Question