User administration in Exchange 2007 using Powershell
Markus Klein
Microsoft's Exchange Server 2007 owns an Exchange Powershell administration interface. Most administrative tasks can now be done using Powershell commands, even GUI can create Powershell commands from the GUI interface.
We will start with the article by introducing you to this useful tool and starting a series of closer considerations in some of the task implementations. We will look at how to administer Exchange Server 2007 from the command line utility. The first is to start the general administration tasks for an Exchange administrator who still performs during their daily work, through some examples of how they work.
Create new Mailboxes
Let's take a look at how to create new Mailboxes with Powershell CMDLet 'New-Mailbox'. The command syntax will be:
Figure 1: Syntax of the New-Mailbox command
As you can see in Figure 1 above, there are many properties that can be used here, but you do not need to use all of them, just some mandatory properties. This will help you simplify many problems.
The first example we will create an Active Directory User named 'John Doe' and the corresponding Mailbox for this user. The mailbox is located in First Storage Group, in the Mailbox Database database. The password is not specified so the Exchange Management Shell will ask for this issue. In addition, you also need to reboot when logging in the next time.
Figure 2: Create User with New-Mailbox Cmdlet
The next example will show how to create a user in Active Directory and resource Mailbox (Equipment Mailbox). The Mailbox resource is located in First Storage Group, in Mailbox Database. Password must be reset at the next login. Exchange Management Shell will remind you of the value of the original password because it was not specified.
Figure 3: Creating an Equipment Mailbox using the New-Mailbox Cmdlet
Remove a Mailbox
Another interesting daily task is to remove a Mailbox. This operation is made easy and this is its syntax:
Figure 4: Syntax of the Remove-Mailbox Cmdlet
Let's take a look at how to disconnect a user's Mailbox from an account and remove it from Active Directory. Mailbox will remain in the Exchange database until the deleted Mailbox ownership cycle is configured for the Mailbox database.
Figure 5: Disconnecting a Mailbox from a user account and removing it from Active Directory
Inside this example you will see that the problem is that there are some questions from the management utility in confirming the actions you are taking. Therefore, there is only a small risk in using this utility.
Change Mailbox settings
Let's consider a more complex CMDLet called 'Set-Mailbox'. This is the syntax of the command:
Figure 6: Syntax of the Set-Mailbox command
You may realize that this is a very powerful command and you can perform a lot of tasks through this syntax. It can be used for:
- Configure to accept mail only from a certain user.
- Configured to only send mails to certain recipients
- Link Mailboxes for each specific user
- Configure email addresses for users
- Set of ownership cycles
- And many other tasks
The first example we will look at how to forward John Does email messages to Mailbox by Jane Doe ( jane@markus-klein.intern ).
Figure 7: Forwarding configuration
Now we use the Get-Mailbox command to find Mailboxes in the TestOU, then use the Set-Mailbox command to configure these Mailboxes. Components like custom warning, prohibit send, prohibit send and receive limits are set to 200 MB, 250 MB, and 280 MB, respectively, respectively. The default limit of the Mailbox database is ignored. This command can be used to configure a set of Mailboxes with greater or smaller restrictions than the Mailboxes in the organization.
Figure 8: Configure Mailbox limits (1)
The third example uses the Get-User command to find all users in TestOU, then use the Set-Mailbox command to change the maximum size of outgoing messages up to 2MB.
Figure 9: Configuring Mailbox limits (2)
Transfer Mailbox
Next we will look at how to transfer a Mailbox using the 'Move-Mailbox' command. The syntax of the command is:
Figure 10: Syntax of the 'Move-Mailbox' command.
This is a very important command in the conversion process. You can configure the Mailbox transfer commands directly from the Powershell script. When you are migrating from Exchange Server 2000, there is no way to transfer Mailbox to Exchange Server 2007, because Exchange System Manager of Exchange Server 2000 does not support this operation as in Exchange Server 2003.
However, you will see in the following example the really interesting things for common administration tasks when moving Mailbox to another Mailbox database on the same server or other server simultaneously or in an Active Other forest directory.
We will use Move-Mailbox to move John Doe's Mailbox (john@markus-klein.intern) to a new Mailbox database called TestMBX, you will realize the difficulty of doing this task.
Figure 11: Transfer Mailbox to another Mailbox database
Displays the mailbox size of users
The final task of this article is to display the mailbox size of the user. The syntax is as follows:
Figure 12: Syntax of the Get-MailboxStatistics command
First we will get Mailbox statistics for all Mailboxes on the internal server.
Figure 13: Retrieve all Mailbox information of a database
You can easily create statistics about Mailbox and save them as an Excel or HTML file. This approach makes it easy to distribute it to users by email or intranet
Conclude
As you can see from this article, administering Exchange Server 2007 is done quite easily using the Powershell CMDLet commands. They are quite simple and highly logical, so you will not have serious problems during use. If you don't know the syntax of each command (which is quite normal even for advisers or long-time admins), the help command will help you with how to use it.
You should read it
- Check mail in Exchange 2007 (Part 2)
- Check Exchange 2007 with PowerShell - Part 1
- Message queues in Exchange 2007
- GroupWise to Exchange 2007 - Interoperability and transformation (Part 6)
- Transfer Exchange 2003 to Exchange 2007 (P.7)
- Transfer Exchange 2003 to Exchange 2007 (Part 2)
- Transfer Exchange 2003 to Exchange 2007 (P.4)
- Switch from Exchange 2000/2003 to Exchange Server 2007 (part 1)
May be interested
- Microsoft Windows PowerShell and SQL Server 2005 SMO - Part 1as you probably know, windows powershell is a new command-line utility and a scripting language that provides a command-line environment for computer interaction and administration surveys. in addition, it provides a scripting capability for fish
- Mobile messaging in Exchange 2003 - Part 4: Access group GALs from mobile devices with GAL Lookupwe went to part 4 of this series to explore mobile mail together using exchange 2003 server sp2 and windows mobile 5.0 devices with the messaging and security feature pack installed. in part 3, we introduced how to install, configure and exchange server activesync web administration administration tools. in this part 4 &
- Discover EMC in Exchange Server 2010 (Part 1)in exchange server 2010, powershell cmdlets has been greatly improved to manage multiple tools, and administrative tasks are made easier on emc.
- Check mail in Exchange 2007 (Part 2)in part one of this article we looked at the default configuration of message tracking within exchange 2007 and how to change those settings using powershell cmdlets. you can remember those major changes in exchange 2007 mail checking on the server
- What is PowerShell Basic commands in PowerShellwhat is powershell basic commands in powershell. first of all, to understand it briefly, powershell is a command-line interface similar to cmd, it can do everything cmd can do and even more. powershell is gradually becoming the default
- Use PowerShell to download any file on Windows 10windows powershell is a tool built into windows 10. this tool has the ability to set up more features than command prompt, better operating system control .... most likely, powershell will replace command prompt in the future.
- PowerShell command in Windowswindows powershell is an executable command line and a scripting language specifically designed for system administrators.
- How to use PowerShell's default parameter to change the command behaviormany people like to use powershell because it allows them to do things that can't be done with the windows gui. however, it is undeniable that some powershell cmdlets can be tedious or complicated. but what if there is a way to edit these cmdlets and get them to 'behave' the way you want?
- How to check PowerShell version in Windows 10powershell is one of the extremely useful command tools for advanced windows 10 users.
- Checking Exchange Server 2007 with MOM 2005 (Part 3)mom 2005 administration interface: analysis of exchange server 2007 management pack changes. mom uses 3 types of data discrimination: event (event), alert (alert) and performance counter to check and save exchange server information.