This is one of the questions I get asked a lot: When and how would you use Exchange 2007 and AD cmdlets together?
The short answer is that the libraries are perfectly compatible and you can mix and match the cmdlets on one machine using the Exchange ones to manage Exchange-related objects/attributes and AD cmdlets for the rest.
For example, AD cmdlets don’t have all the mailbox data, but I can get this from Exchange cmdlets:
Get-QADUser DSotnikov | ForEach { Get-Mailbox $_.DN }
The opposite example would be when I need to reset a password for a mailbox owner – this is something I cannot do with Exchange cmdlets but can do with the QAD stuff:
Get-Mailbox DSotnikov | ForEach { Set-QADUser $_.Identity -UserPassword "M%NewP@ssw0rd" }
Note that instead of piping in the cmdlets directlyI am joining them with ForEach and using DN from AD, or Identity from Exchange to do the match.
System Requirements would be:
- Exchange 2007 management tools installed on the local computer (it does not have to be an Exchange server – just a computer with the Exchange 2007 Management Console).
- AD cmdlets (again, just the cmdlets installed locally – not necessarily on a DC.)
- Have both registered in the same PowerShell console. This can be done by running the following commands in the PowerShell prompt:
PS:\> Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
PS:\> Add-PSSnapin Quest.ActiveRoles.ADManagement
You obviously need to run just one of them if you are using a PowerShell console shipping with either of the cmdlet libraries so you simply add the other library.
If you want more information about Exchange 2007 cmdlets I would highly recommend to subscribe to Evan Dodd’s blog at http://blogs.technet.com/evand (and if you are at a conference with him presenting – make sure you attend the session or chalk-talk – I saw him at this TechEd and he was great!)
Tags: AD cmdlets, cmdlets, Exchange 2007, PowerShell, Exchange, AD