Active Directory Module For Windows Powershell

 admin

Aug 20, 2019  Connecting to Active Directory with Alternate Credentials. By default, the Active Directory PowerShell cmdlets will use a two-step process for determining the user account to connect to AD with. Use the credentials associated with the PowerShell AD provider drive, if the command is run from there. Use the credentials of the logged-on user. The same trick applies to Windows 8 and Windows 8.1 computers as well. But the stories are much different for Windows 7, or Server platforms such as Windows Server 2008 R2, 2012, and 2012 R2. Follow this instruction by 4Sysops if you need to install and enable Active Directory Modules on these versions of Windows.

A prerequisite for just about every Active Directory task in Windows PowerShell is to install the Active Directory PowerShell module. This popular module allows administrators to quickly query and make changes to Active Directory with PowerShell.

In this blog post, we're going to dive into how to install the PowerShell Active Directory module on Windows 10. We'll then cover how to connect to AD with PowerShell and go into the various ways you can authenticate to AD.

Install RSAT (Remote Server Administration Tools)

Before we begin, whether you can use the PowerShell cmdlets to access ADDS depends on your variant of Windows and how old it is. If you are using a workstation variant of Windows (Professional, Education, Enterprise) then you will need to install the Remote Server Administration Tools (RSAT) package that is appropriate for your computer. If you are using a Server variant of Windows, then you will already have RSAT available.

If you don't have RSAT you'll get the annoying 'the term Get-AD* is not recognized as the name of a cmdlet, function, script file, or operable program' type messages when you attempt to run the commands we'll be covering.

RSAT for pre 1809 Windows 10

If you're on Windows 10 pre-build 1809, you'll need to download an RSAT package from the Microsoft. The install is simple and straightforward.

Learn how to find your Windows 10 build version here if you don't know how.

Once you have installed RSAT you will need to ensure the Active Directory Module for Windows PowerShell is enabled in Windows Features. By default, it should be already.

RSAT for post-1809 Windows 10

In versions of Windows from 1809 onwards the RSAT capabilities are available as optional features. There's no need to download an external packages.

To install the ActiveDirectory module on Windows 10 post-1809, use the Add-WindowsCapability cmdlet to enable the Rsat.ActiveDirectory.DS-LDS.Tools optional feature as shown below.

The above syntax was tested on Windows 10 Build 1903 and on Windows 7.

RSAT for Windows Server

On a server operating system you can use the PowerShell ServerManager module to enable the RSAT-AD-PowerShell feature in PowerShell.

Connecting and Authenticating

Once the ActiveDirectory module is set up, you'll then begin using the Active Directory PowerShell cmdlets.

Although the cmdlets interact with different parts of AD, you'll find nearly all of them have common parameters. Two of those parameters are Server and Credential.

Connecting to a Specific Active Directory Domain Controller

By default, the AD cmdlets will find a domain controller for you. However, if you need to connect to a different domain controller, you can use the Server parameter.

The Server parameter isn't mandatory. PowerShell will attempt to find a domain controller to connect to by default. The default domain controller to connect to is determined by trying the following in the listed order:

  1. Use the Server property of objects passed in on the pipeline.
  2. Use the server associated with the AD PowerShell provider drive, if in use.
  3. Use the domain of the client computer.

If you'd like to connect to a specific domain controller, you can do so by providing a value for the Server parameter. You can specify several different ADDS objects in different formats such as:

  • A domain name specified as a FQDN or NETBIOS name such as domain.local or DOMAIN
  • A domain controller specified as a FQDN or NETBIOS name such as server.domain.local or SERVER
  • A fully-qualified domain controller and port such as server.domain.local:3268

Connecting to Active Directory with Alternate Credentials

By default, the Active Directory PowerShell cmdlets will use a two-step process for determining the user account to connect to AD with.

  1. Use the credentials associated with the PowerShell AD provider drive, if the command is run from there.
  2. Use the credentials of the logged-on user.

But you can also specify alternate credentials using the Credential parameter.

The Credential parameter allows you to pass in a PSCredential object or, if you provide a username, you will be prompted for a password and these credentials will be used.

You also have two possible authentication types available, controlled by the AuthType parameter. These are Negotiate (the default) and Basic. Basic authentication is only possible over an SSL connection.

Summary

If you're logged onto a domain-joined computer with a domain account and a recent version of Windows 10, this process is easy. Setting up the PowerShell Active Directory module is a cinch because it will auto-discover the domain controller for you and use your logged-in credential.

But not all environments are the same. Everyone isn't that lucky! This post should give you everything you need to start managing Active Directory with PowerShell right away.

Further Reading

If you enjoyed this post, be sure to check out some similar posts on Active Directory

Subscribe to Adam the Automator

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

Join GitHub today

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments

Active Directory Module For Windows Powershell Windows 10 1903

commented Mar 24, 2018 — with docs.microsoft.com

When you click on that link it states that it is retired, and therefore you cannot install that module.

Documentation needs to be updated to install it through PowerShell.

Talespin movie. Set in a world where martial arts battles and Eastern magic are commonplace, the series follows four young warriors in training that battle the forces of evil. They do this by protecting Shen Gong Wu from villains that would use them to conquer the world.Originally airing on the Kids’ WB block of programming on WB Network in 2003, the series ran for 3 seasons and 52 episodes.

The cmdlets are:
Install-Module Azure and Install-Module AzureRM

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

  • ID: 0c551eb1-7ac5-cb02-cd1b-d67ca3886d85
  • Version Independent ID: fb690e2e-420e-f697-60f2-39520283d385
  • Content: Connect to all Office 365 services in a single Windows PowerShell window
  • Content Source: Enterprise/powershell/connect-to-all-office-365-services-in-a-single-windows-powershell-window.md
  • Service: o365-administration
  • GitHub Login: @JoeDavies-MSFT
  • Microsoft Alias: josephd
assigned JoeDavies-MSFTMar 26, 2018

commented Mar 26, 2018

Thank you for the feedback! We are looking into this.

commented Apr 4, 2018 — with docs.microsoft.com

StewartSiegel33472, I updated the instructions to install the module from the PowerShell command prompt with the Install-Module MSOnline command.

closed this Apr 5, 2018

Download Active Directory Powershell Mod…

commented Dec 21, 2018

I think above link also require update as it redirect to same page.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment