Publicity isn’t everything. Or at least that’s what one of the greatest innovations ever to come out of the Microsoft camp has taught us. PowerShell, by far one of the most powerful tools ever put into the computing public’s hands and the recipient of nothing but “stellar” press, seems to be nothing but a mere curiosity to most techs out there. In fact, along with admitting that I myself rarely get a chance to jump in and use it, I do not know one single server administrator who regularly uses PowerShell in an any useful capacity whatsoever. It is a real shame!
But, this article isn’t on PowerShell itself if you will, rather it is just an introduction to one of the many uses of PowerShell which are wrapped into a tool called the Exchange Management Shell. What a lot of people don’t realize is that the Exchange Management Shell itself is fully based on PowerShell and any of the methods called from within it, can also be accessed in almost exactly the same fashion from within PowerShell itself.
Obviously, this blog post cannot be exhaustive. But I will provide you with one very common and useful example of this utility and give you the links needed to go out and tailor this to your own unique Exchange environment. Literally, this tool opens up unlimited possibilities to managing mail and can be tailored to do anything you can dream of.
So, I know the one thing I face very often as an Exchange administrator is questions and requests about exporting mail. In the past, we might have used a tool like Exmerge to export these mailboxes – which actually worked well and was more than adequate – but there was always something that it couldn’t quite do that would have made your job easier.
Well, PowerShell and the Exchange Management Shell can now do exactly this.
So, let’s take a real life example. You want to export all of the mailboxes in exchange into some PST files that can be archived and kept for future use.
So, the simplest of commands that could be run would be as follows:
get-mailbox | Export-Mailbox -PSTFolderPath C:\PSTFiles\
This, as can be easily inferred from the command itself, simply exports everything as PST into the directory specified. Now, to do more with this, simply add to the above parameters as necessary, for example you could run:
get-mailbox | Export-Mailbox –ContentKeywords “litigation” -PSTFolderPath C:\PSTFiles\
So now, we have refined the export a bit and it will only export those items that have the Keyword “litigation” somwhere within the body of the mesage.
The list of options and the ability to pipe output from one cmdlet into input in another is staggering. Mastering this tool, will definitely put you in the ranks of the top-paid excchange administrators.
Now, I think I have whetted your curiosity, so here are some links to allow you to start to master this tool.
http://technet.microsoft.com/en-us/library/aa998579.aspx – This is specific to the export command we looked at in our example.
http://technet.microsoft.com/en-us/library/aa998225.aspx – This is a general overview of all of the cmdlets available fpr the Exchange Management tools.
Now, hope you have fun with this. The more you get into it, the more fun it all becomes.