If you are planning to run a Powershell script with Active Directory commandlets on a Win 7 machine or any other machine that DOES NOT have AD role then you need to do some preliminary steps as listed below.
By default one can not import Active Directory module in Powershell in Windows 7. You need to do either of the below:
- Download “Active Directory Management Gateway Service” on 2003 or 2008 server [http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=2852]
- Download “Remote Server Administration Tools” on Win 7 [KB958830: http://www.microsoft.com/download/en/details.aspx?id=7887]
By doing this you will get the Active directory module to be used in the Power shell scripting.
In this article I have explained the steps for Windows 7.
After the installation of the KB958830 go to Windows Feature and enabled the highlighted items as below.