Category Archives: Scripting

Powershell one-liner for gathering mailbox stats

  The Get-MailboxStatistics cmdlet is great for showing a range of detailed information about the mailboxes in your organisation.  Sometimes you need to pare down the information to just the really useful stuff (such as mailbox size, item count, etc.) and push it to a CSV file.  Here’s one that I find helpful:   get-exchangeserver… Read More: Powershell one-liner for gathering mailbox stats »

Bulk Create Active Directory Contact Objects

If you’re creating contact objects in Active Directory the Exchange cmdlets New-MailContact, Set-MailContact and Set-Contact are usually sufficient.  On the other hand I haven’t found a way using these cmdlets to set all the attributes that I might need.  For example, the “description” attribute doesn’t appear to feature anywhere. Things have obviously changed with the… Read More: Bulk Create Active Directory Contact Objects »

How to Find Exchange Server 2007 Build Information

The other day I applied Update Rollup 1 for Exchange Server 2007 Service Pack 2 in my test lab and wanted to check that the update was successfully applied.  Being something of a Powershell fan I first tried the command shown below: (get-exchangeserver MyE2K7Server).admindisplayversion The output showed Version 8.2 (Build 176.2), which is the same… Read More: How to Find Exchange Server 2007 Build Information »

How to revert the forest functional level in Windows Server 2008 R2

Windows Server 2008 R2 introduces the ability to revert to an earlier forest or domain functional level.  Previous versions of Active Directory did not have this ability and raising the forest or domain function level was, effectively, a one-way operation.  I say “effectively” because it is possible to revert, but only through highly disruptive recovery… Read More: How to revert the forest functional level in Windows Server… »

The goodness that is Powershell ISE

Earlier this week Nathan Mercer (Technology Advisor for Microsoft) gave me a brief look at the new Powershell Integrated Scripting Environment available with Windows Server 2008 R2.  ISE allows you to run commands and write, test, and debug scripts in a Windows GUI.  It also has multi-line editing, tab completion, syntax coloring, selective execution and context-sensitive help.  The best thing… Read More: The goodness that is Powershell ISE »

Powershell script to filter events using an Xpath query

I have recently spent some time working with Xpath queries as part of Event Log filtering in Windows Server 2008.  It’s a great feature, but one limitation I found was that it doesn’t appear possible to use the starts-with() function when querying Event Logs with either the UI or Wevtutil.exe.  Here’s an example. Let’s say… Read More: Powershell script to filter events using an Xpath query »

Schedule backups of your AD LDS instance using Dsdbutil [2]

In my last post, I provided a small batch file to support scheduled IFM dumps of an AD LDS instance.  Afterwards, I realised that batch files are sooo last century and decided to have a crack at the Powershell version.  I’m no Bwandon, but the script below seems to do the trick. # # Name: Create_IFM_Dump.ps1 #… Read More: Schedule backups of your AD LDS instance using Dsdbutil [2] »