Today I share a script to automate all of the manual steps involved with setting up the Active Directory PowerShell module on your Windows 10 workstation.
- Import Active Directory Module
- Active Directory Module For Windows Powershell 1
- Active Directory Module For Windows Powershell Server 2008
- Jun 15, 2018 Active Directory Module for Windows PowerShell. It is automatically installed on the domain controller. To use the PowerShell cmdlets from the Active Directory module, at least one controller with Windows Server 2008 R2 or higher must exist in your domain. If your network has only DCs with Windows Server 2003 or 2008.
- Why do you need the Azure Active Directory PowerShell Module? This module allows you to perform a lot of the Office 365 user and organisation administration tasks via PowerShell. It’s great for bulk tasks like password resets, password policies, license management/reporting etc.
- 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.
Clickety, Click. Scripty, script.
I recently reloaded my everyday work laptop. After three years it had in-place upgrades from Windows 8 to Windows 8.1 to Windows 10. You can imagine that we dogfood a lot of software as Microsoft employees, so it was well past time for a reload.
Import Active Directory Module
As part of this I had to set up the Active Directory module. Since the process was more than one quick step, I decide this deserves a script to help everyone else in the world as well. How many steps does it take?
Mar 11, 2019 On a Windows 7 computer, you can follow this procedure to install the Active Directory module: Download the Remote Server Administration Tools (RSAT) for Windows 7. Open the Control Panel, start typing features, and then click Turn Windows features on or off. Scroll down to Remote Server Administration Tools and enable the Active Directory Module for Windows PowerShell in Remote Server Administration Tools Role Administration.
- Find and download the CPU-architecture-appropriate Windows 10 RSAT package (Remote Server Administration Tools)
- Install the RSAT
- Enable the Active Directory PowerShell feature
- Update-Help for the AD module
This is mostly a one-time task, except for updating the module help. Generally I only script things that are more repeatable. However, I know many of you like to reload your laptop on a regular basis. I also know that lots of people are deploying Windows 10 right now. So this seemed like a good community service project.
The Script
This script needs to run from an elevated ISE or console session, since it is configuring your system. Obviously it will only run on Windows 10, because that is the goal.
Like any good PowerShell scripter I borrowed code from various sources on the internet. I included comments with the links where I found handy code for downloading a file, installing a hotfix, etc.
Rather than explain the entire script line-by-line, I’ll provide the interesting parts here with comments. DO NOT copy/paste/run the code below. It is not complete. Use the download link at the bottom of this post to get a copy of the full script.
Active Directory Module For Windows Powershell 1
I turned this into a function with full help and verbose output. I always like watching the blue verbose scroll as PowerShell runs. You get that sense of satisfaction that everything in the world is good when you watch your own code perform. #nerdthrills
Active Directory Module For Windows Powershell Server 2008
Download
You can find the code here on the TechNet Script Gallery. Enjoy!