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
Other PowerShell Articles On This Blog
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.
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.
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:
There is a good page on TechNet with additional links
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…
There is also a downloadable conversion guide in .doc format. It is bundled with these samples.
For convenience, I have extracted the file from the bundle and you can download it from here directly.
General PowerShell Getting Started Guides
Microsoft Virtual Academy Jumpstart for PowerShell 3.0. A one-day hands-on Jump Start session designed to teach the busy IT Professional about Windows PowerShell.
Getting Started with Windows PowerShell. An introduction and tutorial, including system requirements and instructions for installing and starting Windows PowerShell on all supported operating systems.
Windows PowerShell User's Guide. A detailed introduction, including real-world scripts and scenarios to get you started
Pat Richards – lots of one liner examples
Glen Scales Exchange Dev Blog – well worth a read!
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.