The Exchange 2007 scripting contest has concluded and a winner has been selected. Congratulations to Nick Smith of Colorado State University on his winning entry: "Return the smallest database"!

Description: Locates the smallest mailbox database (in terms of size) for automatic provisioning process. The script retrieves a collection of mailbox databases, finds the size of each database, sorts the list based upon length, then returns the name of the smallest database.

Script Code

(Get-MailboxDatabase | foreach { get-childitem $_.edbFilePath | select-object name,length} | sort -property length )[0]

The judges agreed that this is a great example of the versatility and power you can get by combining a variety of Exchange management shell cmdlets together with the built-in PowerShell cmdlets as a "one-liner". And the judges also agreed that next time we'll do better about announcing the winning entry in a more timely fashion – sorry for the long wait on the winning result to all who entered the scripting contest!

For his winning entry, Nick has won a trip to next Monday's "Ready for a New Day" Launch event in Seattle, WA that is highlighted by a keynote from Bill Gates:

Thanks to all who entered, and keep writing those PowerShell scripts and one-liners!

- Evan Dodds