After you install the ActiveDirectory module, there is now a new PowerShell option in Administrative Tools, called “Active Directory Module for Windows PowerShell”:
This brings up the bland, DOS-like command prompt with the ActiveDirectory module automatically loaded. But what if you like to work in the Windows PowerShell Integrated Scripting Environment (ISE)? Start up ISE and then run the following command:
That will load the ActiveDirectory module into your ISE session, so that you can use the desired cmdlets.
Querying for User Accounts
To query for user accounts, use the Get-ADUser cmdlet. For example, here is how you would query against your domain for all user accounts:
If you wanted to query for all of the user accounts with the last name “Collicott”, you would run the following:
To export the e-mail addresses for all user accounts to a CSV file, you could run the following:
You can also find additional examples by viewing the help on the cmdlet: