In part 13, I mentioned how to work with the provider for Active Directory (AD). I also mentioned the preferred way to work with AD is with the built-in PowerShell cmdlets. In this post we are going to take a quick look at where the cmdlets are located, and how to load them. In tomorrows post I will show you how to use PowerShell to recover users quickly with Windows Server 2008 R2
When you install the Active Directory Role on your Windows Server 2008 R2 server you will be able to use the GUI administrative tools as well as the PowerShell tools to manage AD. When you want to manage AD with PowerShell on your Windows Servers, you will find a shortcut in Administrative Tools named Active Directory Module for Windows PowerShell. You can simply run the shortcut and it will load the AD module. Depending on what tasks you may want to accomplish you may also need to run the PowerShell session with elevated permissions. You can also choose to open a your normal PowerShell session and import the AD module with the following command (Just like when you work with AD provider):
After you have imported the module or used the shortcut to work with PowerShell AD cmdlets, you can see what commands available to you use in PowerShell you can run the following command:
Get-Command –module ActiveDirectory
As you can see there a lot of PowerShell cmdlets at your fingertips to use to work with AD. You may have also notice all of the PowerShell nouns/objects begin with “AD”. This makes it easy to track down and use these great cmdlets. You can also see a listing of all the cmdlets here: Active Directory Cmdlets in Windows PowerShell
Now you may be wondering how do you manage AD, do you always have to be logged on to a DC. The answer is no, one way you can manage your domain controllers with PowerShell is with the Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1) (RSAT). Thanks Leon for asking the question in an earlier post! Hopefully the RSAT tools will help. These tools can be found here:
The RSAT toolset can do a lot more than just manage AD. The toolset can help provide administrative consoles for various roles and features available on your Windows Server 2008 R2. The RSAT tools can either manage Server Core or full installation of the servers as well. After you have downloaded the proper version of the RSAT (x64 or x86) you can then begin to load to tools you will need to manage your servers from your Windows 7. To load the various tools for your server you will go into the Turn Windows Features on or off control panel. Inside the control panel you will need to select Remote Server administrative tools. The AD PowerShell module is located underneath Role Administration Tools in the AD DS and AD LDS Tools section. After you navigate into the location you will find the Active Directory Module for Windows PowerShell. Simply check the box and click OK and then you will be able to work the AD cmdlets from your Windows 7 workstations as if you were on the server, presuming off course you have permission to do so.
Thanks for reading and if you missed any of the previous posts you can find a master list of series postings located here: PowerShell Not Your Father’s Command Line: 31 Days of PowerShell or on Sarah’s blog here: PowerShell Not Your Father’s Command Line: 31 Days of PowerShell. Lastly Sarah and I want to hear from you email either of us with your comments or suggestions for future postings let us know, we look forward to hearing from you. Have a great day!