0

PowerShell Resources For The Exchange Administrator

A long time ago, in a continent far, far away from where I currently live there was a younger, fitter and better looking version of me.   One of the few woes that this chap had, was that on a Friday afternoon he would be struggling to delete enough files off a server to allow that day’s event log archive process to run.  Site Server 3.0 ( yes, I’m really dating myself now….) was used to replicate the DMZ logs to the archive server as it meant only a single TCP port had to be punched in the firewall.  That  was great.  What was not so great was that it used an Access database engine to keep track of what it had replicated and what could then be deleted.  The deletion process often failed leaving thousands of unwanted files behind on the staging server.  It was these pesky remnants which stood between that younger version of me and a pint of Staropramen.

So you can see the motivation.  Stay behind for hours manually truffling through thousands of directories trying to delete old files, or learn to script….

It came to pass that I got down and dirty with VBScript.  Yes I could have done this using cmd, but VBScript was new and shiny, and also was something neat to learn!  This helped bring balance to the force, and was also excellent at providing repeatable process to implement IT tasks.  This included IIS ADSI modification scripts, AD user provisioning and also for Exchange 2000/2003 tasks.

VBScript was one of the main automation tools for Exchange 2003.  It worked well, but you had to do pretty much everything yourself.

Want a function to search for a mailbox.  No problem, just code it from scratch.

Want to add a recursive search to the above function.  No problem, just code it from scratch.

PowerShell changed the game with Exchange 2007, and it became the weapon of choice.  At last, simple things became simple tasks.

Want to see properties for a mailbox.  No problem, just run Get-Mailbox

Want to add a recursive search.  No problem, just add –Recurse.

 

 

Enough preamble – what’s this page for?  I wanted to have a single place where I could aggregate links and other content that I could then easily refer back to.  It is work in progress, and will change/evolve over time. I will try and post samples where possible to the TechNet galleries and link back to here.

 

Please do add a comment if there is something that you’d like to see added here!

 

 

Introduction To PowerShell For the Exchange Admin

This is a series of articles that I previously wrote.  They discuss changes to scripting Exchange from 2003 to Exchange 2007/2010.   Part 2 has a detailed breakdown of the mechanics involved in Exchange 2010’s remote PowerShell

Part 1

Part 2

Part 3

 

Other PowerShell Articles On This Blog

image

In addition to the articles mentioned above, there are other items that I have written with touch upon PowerShell.  While this may be from a Windows platform perspective, they are still very useful.  The easiest way is to list all articles that have a PowerShell tag.

 

Alternatively use the search tool on the right.

 

Articles with PowerShell tag.

Built-In Help

PowerShell is self describing in that you can use PowerShell to find out more about PowerShell.  This was covered in the Introduction article using the Get-Member cmdlet.  Additionally we can also use Get-Help to retrieve extra information.

PowerShell Get-Help About_*

On this Windows 2008 R2 SP1 server, this returned 89 items.  How do I know 89?  I’m too lazy to count, so I just pipe to Measure-Object.

For example if you want to know the format of PowerShell’s FOR loop, simply run:

Get-Help about_for

TechNet Wiki

There is a good page on TechNet with additional links

Exchange 2010 PowerShell Scripting Resources

VBScript To PowerShell Conversion Guide

For those who still think, in VBScript and then have to convert to PowerShell this is for you.  And yes, I still have a habit of thinking of VBScript syntax…

For convenience, I have extracted the file from the bundle and you can download it from here directly.

 

General PowerShell Getting Started Guides

Blog Links

Pat Richards – lots of one liner examples

Shay Levy – This post for Windows Live Writer formatting is interesting

Development Resources

Glen Scales Exchange Dev Blog – well worth a read!

 

Additional Resources

  • Windows PowerShell Team Blog. The best resource for learning directly from the Windows PowerShell product team.
  • Windows PowerShell Customer Connection. Make a suggestion, send feedback, or file a bug for the Windows PowerShell team. You can file a code bug, a documentation bug, or a localization (language translation) bug.
  • The Hey, Scripting Guy! Blog publishes new content seven days a week, and is consistently ranked in the top five of all Microsoft blogs. The articles are scenario-driven, and written in an engaging and lively manner.
  • The Learn PowerShell page is the Windows PowerShell hub on the TechNet Script Centre.

Cheers,

Rhoderick

Rhoderick Milne [MSFT]

Leave a Reply

Your email address will not be published. Required fields are marked *