Skip to content Skip to sidebar Skip to footer

What Is the Powershell Cmdlet for Installing a Domain Controller to the Domain "Adatum.com"?

This guide explains how to install the Active Directory (Advertizement) 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 ten, Windows Server 2008 R2, Windows Server 2012 R2, and Windows Server 2016.

  • Writer
  • Recent Posts

Also read: How to install the PowerShell 7 Active Directory module.

The installation of the Advertising module varies significantly for the unlike Windows and PowerShell versions. At the time of this writing, the AD module that comes with RAST does not piece of work with PowerShell Core 6.0. Nonetheless, this guide explains how you tin manage Active Directory from PowerShell Core fifty-fifty on macOS and Linux.

Windows 7 ^

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

  1. Download the Remote Server Administration Tools (RSAT) for Windows seven.
  2. Open the Command Console, get-go typing features, and so click Turn Windows features on or off.
  3. Gyre down to Remote Server Assistants Tools and enable the Active Directory Module for Windows PowerShell in Remote Server Assistants Tools > Office Administration Tools > Advertizement DS and AD LDS Tools.
  4. Run Import-Module ActiveDirectory on a PowerShell console.

Active Directory Module for Windows PowerShell on Windows 7

Active Directory Module for Windows PowerShell on Windows 7

If the Windows 7 machine but has PowerShell 2.0 installed, y'all have to add the Import-Module ActiveDirectory command to your profile because PowerShell doesn't load modules automatically. For case, you can import the module in %UserProfile%\My Documents\WindowsPowerShell\profile.ps1. Makes sure you lot've set your execution policy to either RemoteSigned or Unrestricted: Set-ExecutionPolicy RemoteSigned.

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

Active Directory Module in Administrative Tools

Active Directory Module in Administrative Tools

Windows Server 2008 R2 ^

If your Windows Server 2008 R2 machine is a domain controller, the PowerShell Agile Directory Module is already installed. Y'all but 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 take to download RSAT because the tools are already available on Windows Server 2008 R2.

  1. In Server Director, click Add features, and and so:
  2. Select Active Directory module for Windows PowerShell in Remote Server Administration Tools > Role Administration Tools > Advertisement DS and AD LDS Tools.

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

Import-Module ServerManagerAdd-WindowsFeature RSAT-Advert-PowerShell

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

Import-Module ActiveDirectory

Or y'all can right-click the PowerShell icon on the taskbar and select Import organization modules.

Import system modules

Import system modules

Equally on Windows 7, if you desire to make the import permanent, you accept to add the to a higher place import command to your PowerShell profile. Notice this description assumes you haven't updated PowerShell ii on your Windows Server 2008 R2 machine (see the description about Windows seven).

Windows 8, Windows 8.1, Windows 10 ^

Things are a lot easier in Windows viii, Windows 8.1, and Windows 10. All y'all accept to do is download and install RSAT (Windows 8, Windows 8.ane, Windows ten). The installation enables all tools by default, and you lot likewise don't have to import the module. Yous can utilize the AD module right away after you install RSAT.

Windows Server 2012, Windows Server 2012 R2, Windows Server 2016 ^

Every bit 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, y'all can add the module every bit a feature in Server Manager.

  1. Start Server Manager.
  2. Click Manage > Add together Roles and Features.
  3. Click Adjacent until yous attain Features.
  4. Enable Active Directory module for Windows PowerShell in Remote Server Administration Tools > Role Administration Tools > Ad DS and AD LDS Tools.

Install the AD module on Windows Server 2016

Install the AD module on Windows Server 2016

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

Install-WindowsFeature RSAT-Advertising-PowerShell

Installing the AD module on Windows Server 2012 with PowerShell

Installing the AD module on Windows Server 2012 with PowerShell

At that place's no need to import the Server Managing director module kickoff, equally on Windows Server 2008 R2. You too don't have to import the Ad module later the installation.

If yous desire to verify the successful installation of the module, y'all can merely run the Get-ADuser cmdlet.

Install the Advertising module on PowerShell Core six.x on a Windows computer ^

  1. Install RSAT with the method matching to your operating arrangement (see sections above).
  2. Install the WindowsCompatibility module.
    Install-Module -Proper name WindowsCompatibility
  3. Load the WindowsCompatibility module like usual with the Import-Module cmdlet
    Import-Module -Proper 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 Advert cmdlets. This option is good if you only occasionally manage Ad on a PowerShell console and if yous don't have to execute local scripts.

Managing Active Directory on PowerShell Core in an interactive remote session

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. Notwithstanding, you execute the Advertisement cmdlets remotely on a domain controller. In practice, you won't notice much of difference in locally installed cmdlets. To import the Advertisement module on PowerShell Core vi.0, execute these commands:

$S = New-PSSession -ComputerName MyDomainConroller Import-Module -PSsession $Due south -Name ActiveDirectory

Import the AD module on PowerShell Core 6.0

Import the Advertisement module on PowerShell Core 6.0

The first command creates a PowerShell session (PSsession) on the domain controller (replace MyDomainController with the name of your DC) and establishes a persistent connection. Adjacent, we import the ActiveDirectory module from this remote PSsession into our local session.

Yous can now use all AD module cmdlets on your local PowerShell Core panel. Just continue in mind the commands always execute remotely.

If you often work with Advertizement, you tin can add the higher up commands to your profile, for case in Documents\PowerShell\Profile.ps1.

Export the remote Advertizement 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 $Southward -Module ActiveDirectory -OutputModule RemoteAD Remove-PSSession -Session $S Import-Module RemoteAD

Exporting the Active Directory module to a local module

Exporting the Agile Directory module to a local module

These commands will create a local module in your Documents binder under PowerShell\Modules\RemoteAD. However, like with the higher up solution, you lot volition be working with implicit remoting, and all cmdlets will execute remotely. The local RemoteAD module but links to the cmdlets on the domain controller. If you want to employ the RemoteAD module on other machines with PowerShell Core, simply re-create 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 but establishes a connection to the domain controller when you use an AD cmdlet the get-go fourth dimension. You besides don't accept to add together the above commands to your profile because PowerShell will load the local RemoteAD module automatically. However, the downside to this choice is you might have to echo the procedure after updating the Advertising module on the domain controller.

PowerShell Core and Windows PowerShell modules ^

Note that you lot can use Windows PowerShell together with PowerShell Core on the same machine and work with the unlike Advertising 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

PowerShell Core and Windows PowerShell use different folders

PowerShell Core and Windows PowerShell utilize different folders

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

Conclusion ^

Using the Active Directory module has go simpler with each PowerShell version up to Microsoft'southward release of PowerShell Cadre 6.0. Yet, working with implicit remoting and remote sessions has various advantages. One advantage is that you can use disconnected remote sessions. This allows you to start a script, close down your client estimator, and call up the results from the remote automobile later. If yous frequently work with remote sessions, you should become familiar with the different ways you tin can employ PowerShell remote sessions. Once you go used to working with remoting, y'all probably won't miss the local Advertisement module for PowerShell Core.

whipplefecoing.blogspot.com

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

Post a Comment for "What Is the Powershell Cmdlet for Installing a Domain Controller to the Domain "Adatum.com"?"