In the past two weeks I have really started playing with the new AD PowerShell cmdlets from Microsoft. I am really glad these cmdlets are finally here. I will admit though, to get them working in my lab, it was not easy. I cant blame this though on the cmdlets themselves, as my problems stemmed from the fact that I don't have 64-bit virtualization capability yet in my own lab.
To use the cmdlets you need to deal with the following 3 steps:
- You must have the cmdlets themselves, they are part of the ActiveDirectory module for PowerShell v2. This module is a Windows Feature that can be installed ONLY on Windows 7 and Windows Server 2008 R2. Life is super simple if you have a 2008 R2 Domain Controller, as you are good to go to import and use the module on that machine. When you promote an R2 server to a DC, the AD PowerShell Module Windows feature is installed automatically (if its not it’s the same checkbox you use on Windows 7). For Windows 7, you need to install the latest RSAT (Remote Server Admin Tools) and then add the Windows Feature for the PowerShell AD Module. It appears that if you cant use Windows Server 2008 R2 or Windows 7, then you can not leverage these cmdlets right now (this means Windows Server 2008 (non-R2) as well).
- Once you have the module physically installed, you must import the module in your PowerShell v2 session. This is as simple as typing PS C:\> Import-Module ActiveDirectory
- You must have an Active Directory Web Service (ADWS) Implemented on at least one of your Domain Controllers. Any new 2008 R2 DC will have this new service. If you haven't yet deployed a 2008 R2 DC, then you can install the ADWS on a down-level DC by installing the Active Directory Management Gateway Service.
Once these three steps are in place you can then use the cmdlets. You can see the cmdlets a few ways, but perhaps the easiest is to do this: PS C:\> Get-Command -Module ActiveDirectory
By running the above cmdlet I found the following cmdlets:
On the PowerShell Team Blog they posted a great write-up and a really nice graphic showing the cmdlets organized logically
I hope this is a short and sweet guide to help get the cmdlets working for you!
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm.