0% found this document useful (0 votes)
119 views

How To Install The PowerShell Active Directory

Uploaded by

Robert Fong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views

How To Install The PowerShell Active Directory

Uploaded by

Robert Fong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

8/23/2021 How to install the PowerShell Active Directory module | 4sysops

How to install the PowerShell Active


Directory module
Home (https://4sysops.com) / Wiki (https://4sysops.com/wiki/) / How to install the PowerShell Active Directory module
4sysops - The online community for SysAdmins and DevOps

All Docs (https://4sysops.com/wiki/)

PowerShell’s Docs (https://4sysops.com/groups/powershell/wiki/) ▸ PowerShell Modules


(https://4sysops.com/groups/powershell/wiki/?folder=449890) ▸ How to install the PowerShell Active Directory
module

Read (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/)
History (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/history)

This guide explains how to install the Active Directory (AD) module for PowerShell Core 6.0 and
Windows PowerShell. For Windows PowerShell, the tutorial describes how to install the AD module
for Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008 R2, Windows Server
2012 R2, and Windows Server 2016.

PowerShell for everyone: Big cheat sheet for your office wall.
Order now for free! Ad

Author Recent Posts

Michael Pietroforte (Https://4sysops.Com/Members/Michael-Pietroforte/)


Michael Pietroforte is the founder and editor in chief of 4sysops. He has more than 35 years of experience in IT man-
agement and system administration.

(https://4s  
(https://4sysops.com/archives/results-of-the-4sysops-member-and-author-competition-in-2018/)
ysops.co
m/membe
https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 1/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

rs/michae
l-
pietro-
forte/)

Contents of this article

Windows 7
Windows Server 2008 R2
Windows 8, Windows 8.1, Windows 10
Windows Server 2012, Windows Server 2012 R2, Windows Server 2016
Install the AD module on PowerShell Core 6.x on a Windows computer
All versions: Import the ActiveDirectory module remotely
PowerShell Core and Windows PowerShell modules
Conclusion

Also read: How to install the PowerShell 7 Active Directory module (https://4sysops.com/archives/how-to-
install-the-powershell-7-active-directory-module/).

Get full control over your Windows update process


Download WuInstall now! Ad

The installation of the AD module varies significantly for the different Windows and PowerShell versions. At
the time of this writing, the AD module that comes with RAST does not work with PowerShell Core 6.0.
However, this guide explains how you can manage Active Directory from PowerShell Core even on macOS
and Linux.

Windows 7 ^
On a Windows 7 computer, you can follow this procedure to install the Active Directory module:

1. Download (http://www.microsoft.com/en-us/download/details.aspx?id=7887) the Remote Server Ad-


ministration Tools (RSAT) for Windows 7.
2. Open the Control Panel, start typing features, and then click Turn Windows features on or off.
3. Scroll down to Remote Server Administration Tools and enable the Active Directory Module for
Windows PowerShell in Remote Server Administration Tools > Role Administration Tools >
AD DS and AD LDS Tools.
4. Run Import-Module ActiveDirectory on a PowerShell console.
 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 2/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Active-Directory-Module-for-Windows-PowerShell-on-

Windows-7.png)

Active Directory Module for Windows PowerShell on Windows 7

If the Windows 7 machine only has PowerShell 2.0 installed, you have to add the Import-Module ActiveDi-
rectory command to your profile (https://4sysops.com/archives/the-powershell-profile/) because PowerShell
doesn't load modules automatically. For instance, you can import the module in %UserProfile%\My
Documents\WindowsPowerShell\profile.ps1. Makes sure you've set your execution policy to either Remote-
Signed or Unrestricted: Set-ExecutionPolicy RemoteSigned.

IT Help Desk Software - Asset Management - IT Project Management


Download ManageEngine ServiceDesk Plus! Ad

Another option is to open the module from the Administrative Tools folder in the Control Panel.

 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 3/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Active-Directory-Module-in-Administrative-Tools.png)

Active Directory Module in Administrative Tools

Windows Server 2008 R2 ^


If your Windows Server 2008 R2 machine is a domain controller, the PowerShell Active Directory Module is
already installed. You only have to install the module on member servers. The procedure on Windows
Server 2008 R2 is similar to that on Windows 7. (Note that the module is not available for Windows Server
2008.)

One difference is that you don't have to download RSAT because the tools are already available on Win-
dows Server 2008 R2.

1. In Server Manager, click Add features, and then:


2. Select Active Directory module for Windows PowerShell in Remote Server Administration
Tools > Role Administration Tools > AD DS and AD LDS Tools.

Alternatively, you can install the module from a PowerShell console:

Import-Module ServerManagerAdd-WindowsFeature RSAT-AD-PowerShell

After copying the module to your computer, you have to import it:

Import-Module ActiveDirectory

Or you can right-click the PowerShell icon on the taskbar and select Import system modules.

 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 4/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Import-system-

modules.png)

Import system modules

As on Windows 7, if you want to make the import permanent, you have to add the above import command
to your PowerShell profile. Notice this description assumes you haven't updated PowerShell 2 on your Win-
dows Server 2008 R2 machine (see the description about Windows 7).

Windows 8, Windows 8.1, Windows 10 ^


Things are a lot easier in Windows 8, Windows 8.1, and Windows 10. All you have to do is download and
install RSAT (Windows 8 (http://www.microsoft.com/en-us/download/details.aspx?id=28972),  Windows 8.1
(http://www.microsoft.com/en-us/download/details.aspx?id=39296),  Windows 10
(https://www.microsoft.com/en-us/download/details.aspx?id=45520)). The installation enables all tools by
default, and you also don't have to import the module. You can use the AD module right away after you in-
stall RSAT.

Windows Server 2012, Windows Server 2012 R2, Windows Server 2016 ^
As on Windows Server 2008 R2, the AD module is already installed on domain controllers on Windows
Server 2012, Windows Server 2012 R2, and Windows Server 2016. On member servers, you can add the
module as a feature in Server Manager.

1. Start Server Manager.


2. Click Manage > Add Roles and Features.
3. Click Next until you reach Features.
4. Enable Active Directory module for Windows PowerShell in Remote Server Administration
Tools > Role Administration Tools > AD DS and AD LDS Tools.

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Install-the-AD-module-on-Windows-Server-2016.png)

Install the AD module on Windows Server 2016

Alternatively, you can install the module from a PowerShell console:

Install-WindowsFeature RSAT-AD-PowerShell  

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 5/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Installing-the-AD-module-on-Windows-Server-2012-

with-PowerShell.png)

Installing the AD module on Windows Server 2012 with PowerShell

There's no need to import the Server Manager module first, as on Windows Server 2008 R2. You also don't
have to import the AD module after the installation.

If you want to verify the successful installation of the module, you can just run the Get-ADuser cmdlet.

Install the AD module on PowerShell Core 6.x on a Windows computer ^


1. Install RSAT with the method matching to your operating system (see sections above).
2. Install the WindowsCompatibility module.
Install-Module -Name WindowsCompatibility

3. Load the WindowsCompatibility module like usual with the Import-Module cmdlet
Import-Module -Name WindowsCompatibility

4. Load the ActiveDirectory module with the Import-WinModule cmdlet


Import-WinModule -Name ActiveDirectory

All versions: Import the ActiveDirectory module remotely ^


Create an interactive remote session

The simplest option is to create an interactive remote session to your domain controller with the Enter-
PSsession cmdlet:

Enter-PSsession MyDomainConroller

You can then work right away with the AD cmdlets. This option is good if you only occasionally manage AD
on a PowerShell console and if you don't have to execute local scripts.

 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 6/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Managing-Active-Directory-on-PowerShell-Core-in-an-

interactive-remote-session.png)

Managing Active Directory on PowerShell Core in an interactive remote session

Import the AD module from a remote session

The second option uses implicit remoting and allows you to run the AD cmdlets from a local session. How-
ever, you execute the AD cmdlets remotely on a domain controller. In practice, you won't notice much of dif-
ference in locally installed cmdlets. To import the AD module on PowerShell Core 6.0, execute these
commands:

$S = New-PSSession -ComputerName MyDomainConroller

Import-Module -PSsession $S -Name ActiveDirectory

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Import-the-AD-module-on-PowerShell-Core-6.0.png)

Import the AD module on PowerShell Core 6.0

The first command creates a PowerShell session (PSsession) on the domain controller (replace MyDomain-
Controller with the name of your DC) and establishes a persistent connection. Next, we import the ActiveDi-
rectory module from this remote PSsession into our local session.

You can now use all AD module cmdlets on your local PowerShell Core console. Just keep in mind the com-
mands always execute remotely.

If you often work with AD, you can add the above commands to your profile, for instance in
Documents\PowerShell\Profile.ps1.

Export the remote AD module to a local module

Alternatively, you can export the AD cmdlets from a remote session to a local module:

$S = New-PSSession -ComputerName MyDomainController

Export-PSsession -Session $S -Module ActiveDirectory -OutputModule RemoteAD

Remove-PSSession -Session $S

 
Import-Module RemoteAD

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 7/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/Exporting-the-Active-Directory-module-to-a-local-

module.png)

Exporting the Active Directory module to a local module

These commands will create a local module in your Documents folder under
PowerShell\Modules\RemoteAD. However, like with the above solution, you will be working with implicit re-
moting, and all cmdlets will execute remotely. The local RemoteAD module only links to the cmdlets on the
domain controller. If you want to use the RemoteAD module on other machines with PowerShell Core, sim-
ply copy the RemoteAD folder to the PowerShell Core module folder on the second machine.

The difference with the "import solution" is that in the "export solution," PowerShell only establishes a con-
nection to the domain controller when you use an AD cmdlet the first time. You also don't have to add the
above commands to your profile because PowerShell will load the local RemoteAD module automatically.
However, the downside to this option is you might have to repeat the procedure after updating the AD mod-
ule on the domain controller.

PowerShell Core and Windows PowerShell modules ^


Note that you can use Windows PowerShell together with PowerShell Core on the same machine and work
with the different AD modules in both shells. If you installed RSAT, the AD module for Windows PowerShell
will reside in this folder:

$env:windir/System32/WindowsPowerShell/v1.0/Modules/ActiveDirectory

If you used the export solution, the RemoteAD module will be in this folder:

$env:userprofile/Documents/PowerShell/Modules/RemoteAD

 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 8/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/wp-content/uploads/bp-attachments/449877/PowerShell-Core-and-Windows-PowerShell-use-differ-

ent-folders.png)

PowerShell Core and Windows PowerShell use different folders

PowerShell Core does not import modules in WindowsPowerShell folders, and Windows PowerShell does
not load PowerShell Core modules, which are always in PowerShell folders. Thus, you don't have to worry
about conflicts between the different AD modules in PowerShell Core and Windows PowerShell.

Conclusion ^
Using the Active Directory module has become simpler with each PowerShell version up to Microsoft's re-
lease of PowerShell Core 6.0. However, working with implicit remoting and remote sessions has various ad-
vantages. One advantage is that you can use disconnected remote sessions
(https://4sysops.com/archives/powershell-disconnected-remote-sessions/). This allows you to start a script,
shut down your client computer, and retrieve the results from the remote machine later. If you often work
with remote sessions, you should become familiar with the different ways you can use PowerShell remote
sessions (https://4sysops.com/archives/powershell-remote-jobs-indisconnectedsession-asjob-and-start-
job/). Once you get used to working with remoting, you probably won't miss the local AD module for Power-
Shell Core.

+12

(https://4sysops.com/members/theycallmebo/) (https://4sysops.com/members/paolo/)

(https://4sysops.com/members/heykip/)

Join the 4sysops PowerShell group! (https://4sysops.com/groups/powershell?


utm_source=4sysops&utm_medium=endpage&utm_campaign=PowerShell&utm_term=member)

Your question was not answered? Ask in the forum!


(https://4sysops.com/groups/powershell/forum/?
utm_source=4sysops&utm_medium=endpage&utm_campaign=PowerShellForum)

 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 9/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

Tags: active directory (https://4sysops.com/wiki/?bpd_tag=active+directory), powershell


(https://4sysops.com/wiki/?bpd_tag=powershell), powershell module (https://4sysops.com/wiki/?
bpd_tag=powershell+module)

PowerShell Modules (https://4sysops.com/groups/powershell/wiki/?folder=449890)


Discussion (30)

Nazir

Thu, Aug 18 2016 at 8:19 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409502)

When attempting to import AD module to %UserProfile%My Documents I receive the following error:

powershell a positional parameter cannot be found that accepts argument '%UserProfile%My'.

At line:1 char:1

Any help would be very much appreciated.

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409502#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Thu, Aug 18 2016 at 8:21 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-409503)

Can you post the exact command you are using?

+2

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409503#RESPOND)

Nazir

Thu, Aug 18 2016 at 8:28 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409505)

PS C:> Import-Module ActiveDirectory %UserProfile%My DocumentsWindowsPowershe


llprofile.ps1
Import-Module : A positional parameter cannot be found that accepts argument
'%UserProfile%My'.
At line:1 char:1
+ Import-Module ActiveDirectory %UserProfile%My
DocumentsWindowsPowershellprofi ...
 
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 10/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

~~~
+ CategoryInfo          : InvalidArgument: (:) [Import-Module], ParameterB
indingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
.Commands.ImportModuleCommand

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409505#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Thu, Aug 18 2016 at 8:50 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-direc-
tory-module/#comment-409506)

You have to use $env:userprofile instead of %UserProfile% What is profile.ps1 for?

+2

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409506#RESPOND)

Nazir

Thu, Aug 18 2016 at 9:18 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-


directory-module/#comment-409507)

Forgive my ignorance, I'm assuming the command will create a .ps1, so that each time I run
PowerShell from within my profile, it will execute the AD module import automatically.

Anyways, it still throwing the same error, but this time it has recognised/picked up my profile
name. I'll go away and spend a bit of time researching t o resolve this and post any findings
that may help anyone.

Thank you for your time so far.

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409507#RESPOND)

Nazir

Thu, Aug 18 2016 at 8:26 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409504)

S C:> Import-Module ActiveDirectory %UserProfile%My DocumentsWindowsPowershe


llprofile.ps1
 
I have put also put it in quotation marks as there is a space in the name of the directory, but this also did not
work.

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 11/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409504#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Thu, Aug 18 2016 at 9:47 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-409508)

If you want to load a module automatically, you have to copy it to a module folder. Run $env:PSModulePath
to get a list of your module folders.

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409508#RESPOND)

Scott

Fri, Sep 9 2016 at 11:35 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409509)

Your issue is the space between My and Documents.  The line should read:

Import-Module ActiveDirectory "$env:userprofileMy DocumentsWindowsPowershellprofile.ps1"

However, this is not what the article said do.  It said add:

Import-Module ActiveDirectory

To:

"$env:userprofileMy DocumentsWindowsPowershellprofile.ps1"

So what you could do is the following to append the commend to the existing profile.ps1 or create it if
missing.

Import-Module ActiveDirectory >> "$env:userprofileMy DocumentsWindowsPowershellprofile.ps1"

+2

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409509#RESPOND)

Moin

Sun, Nov 6 2016 at 10:35 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409510)

i am using windows server r-2 but cannot fount AD-Lds tools

+2

REPLY
 
(HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409510#RESPOND)

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 12/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

ursJAR

Mon, Nov 7 2016 at 2:58 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409511)

I am using PowerShell on my macOS. Can I import the AD module to manage my AD from macOS?

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409511#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Mon, Nov 7 2016 at 3:10 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-409512)

Last time I played with PowerShell on a Mac (https://4sysops.com/archives/install-powershell-on-mac-os-


x/), most sophisticated modules didn't work. My guess is that the Active Directory Module is also not sup-
ported on OS X.

+2

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409512#RESPOND)

Sergey

Thu, Nov 24 2016 at 7:32 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409513)

I have this type of error (PowerShell 2.0, Win7 64 bit SP1) after having done all manipulations.

"WARNING: Default drive initialization error: "Can not find a default server with Active Directory Web Ser-
vices running"

+2

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409513#RESPOND)

Sergey

Thu, Nov 24 2016 at 7:42 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409514)

The answer

"A key requirement to use the AD cmdlet’s to manage an Active Directory deployment is the following:

 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 13/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

A Windows Server 2008 R2 Active Directory Web Services (ADWS) service must be installed on at least
one domain controller in the AD domain or on one server that hosts your AD LDS instance. For more infor-
mation about ADWS, see AD DS: Active Directory Web Services (http://go.microsoft.com/fwlink/?
LinkID=141393 (http://go.microsoft.com/fwlink/?LinkID=141393)).

If you receive this error:

‘Unable to find a default server with Active Directory Web Service running’"

You do not have ADWS installed on at least one DC.

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409514#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Thu, Nov 24 2016 at 8:12 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-409515)

Thanks for the tip!

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409515#RESPOND)

Dennis Graham

Wed, Feb 22 2017 at 9:07 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409516)

Michael,

Thank you for giving so much to the community and for this article in particular.  I recall the euphony that the
PS community had when Windows Server 2008 R2 came out.  My question is can AD Modules and func-
tionality be done on a Windows Server 2008 R1 Server; and are  there instructions on how to accomplish
this?

Dennis

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409516#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
 
Wed, Feb 22 2017 at 9:12 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-409517)
https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 14/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

Dennis, thanks! Do you mean Windows Server 2008 R2 or Windows Server 2008? There is no R1. On
R2, it should work (as discussed in the article). I am unsure if the AD module works on Windows Server
2008 because this Windows version  only supports PowerShell 2
(https://4sysops.com/archives/powershell-versions-and-their-windows-version/). I think you will need this
(https://www.microsoft.com/en-us/download/details.aspx?id=2852).

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409517#RESPOND)

John

Wed, Aug 7 2019 at 10:41 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-direc-


tory-module/#comment-585573)

To be able to run AD powershell scripts against a Windows Server 2008 domain controller, it seems
the install of the Active Directory Management Gateway Service is required.

To install the Active Directory Management Gateway Service on Windows Server 2008 domain con-
troller, it requires a hotfix that is mentioned in the link you provided:

  (https://support.microsoft.com/en-us/kb/969166)https://support.microsoft.com/en-us/kb/969166
(https://support.microsoft.com/en-us/kb/969166)

However, the download site seems to no longer be valid. Does you or anyone know how to obtain this
hotfix? Or perhaps if there's another workaround to be able to run Active Directory powershell scripts
against a Windows Server 2008 domain controller?

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=585573#RESPOND)

Harry

Fri, Mar 24 2017 at 3:41 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409518)

Installed AD module for powershell in windows 7 . AD-getcomputer command works but it doesnot recog-
nizes "-properties *" . Any idea

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409518#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Fri, Mar 24 2017 at 7:01 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-409519)

Do you mean Get-ADComputer (https://technet.microsoft.com/en-us/library/ee617192.aspx)? 


What com-
mand did you try to execute?

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 15/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409519#RESPOND)

Jose

Thu, Nov 30 2017 at 4:28 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-409520)

Very good man. Thanks a lot.

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=409520#RESPOND)

Shashank

Wed, May 23 2018 at 9:55 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-420412)

Thank you for a detailed answer. I did search on internet and still wasn't quite clear how to get this working
on Windows 10. There are so many different variations between different version of windows. Your blog ex-
plained in clear terms what to do along with the links. Thank a lot.

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=420412#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Wed, May 23 2018 at 11:24 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-420464)

Thanks!

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=420464#RESPOND)

vijay

Mon, Jul 9 2018 at 10:20 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-426914)

hi

Please help me here.when i am trying to install windows server 2016 AD via Power shell.
 
I am getting below error.

PS C:\Users\vijay> $ouNameSync = 'AccountsToSync'


https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 16/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

$ouNameNoSync = 'AccountsNotToSync'

New-ADOrganizationalUnit -Name $ouNameSync -Path "DC=adatum,DC=com" -ProtectedFromAcciden-


talDeletion $false
New-ADOrganizationalUnit -Name $ouNameNoSync -Path "DC=adatum,DC=com" -ProtectedFromAcciden-
talDeletion $false

New-ADUser -Name 'Beverly Beach' -GivenName 'Beverly' -Surname 'Beach' -SamAccountName 'bbeach' -
UserPrincipalName '[email protected]' -AccountPassword (ConvertTo-SecureString -AsPlainText
'Pa55w.rd' -Force) -Path "OU=$ouNameSync,DC=adatum,DC=com" -PassThru | Enable-ADAccount
New-ADUser -Name 'Darwin Shivers' -GivenName 'Darwin' -Surname 'Shivers' -SamAccountName 'dshiv-
ers' -UserPrincipalName '[email protected]' -AccountPassword (ConvertTo-SecureString -AsPlainText
'Pa55w.rd' -Force) -Path "OU=$ouNameNoSync,DC=adatum,DC=com" -PassThru | Enable-ADAccount

New-ADOrganizationalUnit : The server is unwilling to process the request


At line:4 char:1
+ New-ADOrganizationalUnit -Name $ouNameSync -Path "DC=adatum,DC=com" - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (OU=AccountsToSync,DC=adatum,DC=com:String) [New-
ADOrganizationalUnit],
ADException
+ FullyQualifiedErrorId :
ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADOrganizatio
nalUnit

New-ADOrganizationalUnit : The server is unwilling to process the request


At line:5 char:1
+ New-ADOrganizationalUnit -Name $ouNameNoSync -Path "DC=adatum,DC=com" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (OU=AccountsNotToSync,DC=adatum,DC=com:String) [New-
ADOrganizationalUnit
], ADException
+ FullyQualifiedErrorId :
ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADOrganizatio
nalUnit

New-ADUser : The server is unwilling to process the request


At line:7 char:1
+ New-ADUser -Name 'Beverly Beach' -GivenName 'Beverly' -Surname 'Beach ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (CN=Beverly Beac...C=adatum,DC=com:String) [New-ADUser],
ADException
+ FullyQualifiedErrorId :
ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADUser

New-ADUser : The server is unwilling to process the request


At line:8 char:1
+ New-ADUser -Name 'Darwin Shivers' -GivenName 'Darwin' -Surname 'Shive ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (CN=Darwin Shive...C=adatum,DC=com:String) [New-ADUser],
ADException  
+ FullyQualifiedErrorId :
ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADUser
https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 17/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

PS C:\Users\vijay>

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=426914#RESPOND)

Chris (Rank: 3)

(https://4sysops.com/members/hotsauceonerrything/)
Thu, May 2 2019 at 8:51 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-508519)

What's the difference between Enable-WindowsOptionalFeature, Install-WindowsFeature, and Add-Win-


dowsFeature? When I try to run either of these I get "The term 'Add-WindowsFeature' is not recognized
as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and
try again."

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=508519#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Thu, May 2 2019 at 8:40 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-508738)

Chris, I guess you tried the commands on a Windows client. As described in the article, Add-Windows-
Feature only works on Windows Server.  Install-WindowsFeature (https://docs.microsoft.com/en-
us/powershell/module/servermanager/install-windowsfeature?view=winserver2012r2-ps) replaces Ad-
WindowsFeature. But I guess Ad-WindowsFeature will still work for a while.

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=508738#RESPOND)

Michael Pietroforte (Rank: 4)

(https://4sysops.com/members/michael-pietroforte/)
Wed, May 8 2019 at 8:39 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-511382)

@luke (https://4sysops.com/members/luke/) thanks for adding a new section to the wiki doc: 

Install the AD module on PowerShell Core 6.x on a Windows computer (https://4sysops.com/wiki/how-to-in-



stall-the-powershell-active-directory-module/#install-the-ad-module-on-powershell-core-6x-on-a-windows-
computer)

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 18/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

You received 60 member points.

+1

(https://4sysops.com/members/heykip/)

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=511382#RESPOND)

Derli Dias Campos Junior

Wed, May 15 2019 at 9:11 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-516523)

That works brilliantly, but it just has not been that perfect because it won't work if I set it as a task scheduller.

The import-module won't import the Active Directory if run from Task scheduler.

Any ideas?

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=516523#RESPOND)

viki (http://www.dotnetgyaan.in/)

Thu, May 16 2019 at 1:31 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-516770)

Great Article after long searching on net i got the solution. Thanks

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=516770#RESPOND)

Raj P

Tue, Jun 11 2019 at 4:31 pm (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-


module/#comment-530403)

Thanks - this article really helps us ..

+1

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=530403#RESPOND)

 
Rich heykip (Rank: 1)

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 19/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

(https://4sysops.com/members/heykip/)
Thu, Jun 13 2019 at 11:31 am (https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-
module/#comment-531283)

Yes powershell saves the day especially when I need to connect to office 365. Thank you for the helpful
details!

This reminds me I need to get the new RSAT

Cheers

https://www.microsoft.com/en-us/download/confirmation.aspx?id=45520&6B49FDFB-8E5B-4B07-BC31-
15695C5A2143=1 (https://www.microsoft.com/en-us/download/confirmation.aspx?id=45520&6B49FDFB-
8E5B-4B07-BC31-15695C5A2143=1)

REPLY (HTTPS://4SYSOPS.COM/WIKI/HOW-TO-INSTALL-THE-POWERSHELL-ACTIVE-DIRECTORY-MODULE/?
REPLYTOCOM=531283#RESPOND)

Leave a Reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Notify me of followup comments via e-mail. You can also subscribe (https://4sysops.com/comment-subscriptions/?
srp=449877&srk=04bc148b9b079be8f64c0a64df80dffb&sra=s&srsrc=f) without commenting.

POST COMMENT

Receive new post notifications


 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 20/21
8/23/2021 How to install the PowerShell Active Directory module | 4sysops

Subscribe to post notifications

Name

Email Address
[email protected]

Subscribe

(http://twitter.com/4sysops/) (http://www.facebook.com/4sysops)

(https://www.linkedin.com/company/4sysops/) (https://4sysops.com/feed/)

© 4sysops 2006 - 2021

 

https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/ 21/21

You might also like