Server Administration in Exchange 2007 using Powershell CmdLets

In this article I want to dive a little deeper into the high end functionalities and possibilities of the Powershell. I especially want to describe Database and Storage Group Management using Powershell Cmdlets in detail which, in my daily experience as a consultant, is one of the most server administration tasks for messaging administrators nowadays. Messaging systems are the most “living” servers in your network environment with a continuous growth of the amounts of data being worked with. This means nearly every administrator has to change database locations and physical or logical structures of the databases often during a server’s lifetime.

Managing Storage Groups

A storage group can be defined as a logical container for databases and are associated with their own system and transaction log files. If you ever need a new collection of logfiles or want to configure something special for them (e.g. enable circular logging or local continuous replication), you will need to configure a new group of databases.

The syntax of the New-StorageGroup cmdlet is the following:

Figure 1: Syntax of New-StorageGroup cmdlet

For example, creating a new storage group called MyNewGroup on a specific folder location, you will need the following syntax:

Figure 2: Creating a new Storage Group

So, now we have seen that it is quite easy to create a new storage group. Never-the-less, it is easier to remove existing ones. This can be done using the remove-storagegroup cmdlet, shown below:

Figure 3: Syntax of the Remove-StorageGroup Cmdlet

If you have a look at the number of parameters of this cmdlet, you will see the syntax is all quite simple. So, if you now would like to remove an existing storage group called MyNewGroup, you will have to use the following code:

Figure 4: Removing the MyNewGroup Storage Group

If you already have created a new storage group and now need to modify some of its settings (e.g. enable circular logging) you will have to use the Set-StorageGroup cmdlet with the following syntax.

Figure 5: Syntax of the Set-StorageGroup Cmdlet

Finally, concerning storage group tasks, we will have a look at how to modify the StorageGroupPath from the command line. You might need this task when you configure new storage to your server and then want to move the complete storage group to the server.

Figure 6: Syntax of the Move-StorageGroupPath

So for example, moving the Log Folders to another path would lead you to the following command line:

Figure 7: Moving Log Folder Paths using Move-StorageGroupPath Cmdlet

As you might have recognized, working with Storage Groups using cmdlets is quite easy and you do not have to know a lot of parameters and different syntaxes. And if you work with these powerful tools more in the near future, you might find them easier to use than the Exchange Management Console.

Mailbox Database Management

In the second part of this article we will now look at Mailbox Database Management some more. If you are using Exchange Server 2007 Enterprise Edition you are able to create 50 databases spread across 50 storage groups. This will give you the opportunity to configure your messaging system in a way most suitable to your Organization.  With Exchange Server 2007 Standard Edition you are able to create 5 databases split into a maximum of 5 storage groups.

Exchange Server 2007 will support only one public folder database. But generally you will not need public folder databases anymore because they need to be migrated to Windows SharePoint Services or Microsoft Office SharePoint Server 2007. 

We will now take a look at how to create a new Mailbox Database on our Exchange Server 2007 using the New-Mailbox Database cmdlet. This cmdlet has the following syntax:

Figure 8: Syntax of the New-MailboxDatabase Cmdlet

So if we now need to create a new mailbox database called “MyMailboxDB” in our existing “MyNewGroup” storage group, we will need the following command line.

Figure 9: Creating a new mailbox database using the New-MailboxDatabase Cmdlet

If you have already created a mailbox database and you want some of its properties to change, you will need to use the Set-MailboxDatabase Cmdlet, shown below:

Figure 10: Syntax of the Set-MailboxDatabase Cmdlet

With this powerful cmdlet for example you can create database limits, indexing, journaling, deleted items retention and lots of other properties.

If you need to delete a mailbox database on your Exchange Server 2007 machine, the following cmdlet will help you:

Figure 11: Syntax of the Remove-MailboxDatabase Cmdlet

If you need to remove an existing mailbox database called “MyMailboxDB” you will need the following syntax:

Figure 12: Removing mailbox databases using the Remove-MailboxDatabase Cmdlet

If we next want to move the mailbox database files to a new location on your server storage, you will need to use the Move-DatabasePath using the following cmdlet:

Figure 13: Syntax of the Move-DatabasePath Cmdlet

As you might have recognized within this chapter, database management using Powershell is quite simple.

A full list of all the Exchange Server 2007 cmdlets used for Database and Storage Group Management can be found at: TechNet: Managing Storage Groups and Databases.


I have tried to show that Exchange Server 2007 management using the cmdlets makes your daily work more efficient than before. And if you need to perform some of these tasks more than once, you can save these commands as a .ps1 file and run them again and again whenever you want or need to. If you are a consultant or have to set up lots of Exchange Servers with the same basic configuration, these scripts save a lot of work and time that you can spend on other administrative tasks.

About The Author

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top