Archive for December, 2008

Exchange 2007 create new Storage Groups with Mailbox Database

After a default Exchange 2007 SP1 installation, there is one Storage Group with one Mailbox Database available and mounted. You have to change the logfile path and database path manually. If you use the following script, you can create one, two, three, four (or more) Storage Groups and Databases fully automatic. Let’s say you’ve installed a new Exchagne 2007 server with three partitions.

————————————————
# This script creates two storage groups named SG1 and SG2, with mailbox stores MB1 and MB2, and finally mounts them.
# C: – Operating System
# D: – Exchange Logfiles/Systemfiles
# E: – Exchange Databases

# Environment variables
$server = “srv-ex01″
$logfilepath = “D:\Log”
$mbxfilepath = “E:\Database”

# Creating the Storage Groups and Mailbox Stores
foreach (
$i in (1,2,3,4)
){
new-storagegroup -name SG$i -server $server -logfolderpath “$logfilepath\SG$i” -systemfolderpath “$logfilepath\SG$i”
}
foreach (
$i in (1,2,3,4)
){
new-mailboxdatabase -storagegroup $server\SG$i -name MB$i -edbfilepath “$mbxfilepath\MB$i\MB$i.edb”
mount-database MB$i
}
————————————————

Exchange 2007 Send Mailbox sizes with PowerShell

It could be verry usefull to receive a overview of all the mailbox sizes in your environments every day, week or month. You can see verry quickly when a users mailbox is growing to fast….The easiest way is to automate this, so i’ve made a PowerShell script to do this for me :)

—————————————————–
$body = Get-MailboxStatistics | sort-object -descending totalItemSize | ft DisplayName, @{expression={$_.totalitemsize.value.ToMB()};label=”Mailbox Size(MB)”}, itemcount, lastlogontime | out-string

$From = “administrator@e2k7.local”
$to = “m.swinkels@e2k7.local”
$server = “srv-ex01.e2k7.local”
$subject = “Mailbox overview – srv-ex01.e2k7.local”
$msg = new-object System.Net.Mail.MailMessage $From, $to, $subject, $body
$client = new-object System.Net.Mail.SmtpClient $Server
$Client.Send($msg)
—————————————————–

Copy this script into Notepad and save it as MailboxSizes.ps1. You can schedule this script to run every day, or every week using the following command:

C:\WINDOWS\system32\Windowspowershell\v1.0\powershell.exe -PSConsoleFile “D:\ExchSvr\Bin\exshell.psc1″ C:\Scripts\MailboxSizes.ps1

C:\WINDOWS\system32\Windowspowershell\v1.0\powershell.exe
The path to Powershell.exe needed to run the script

-PSConsoleFile “D:\ExchSvr\Bin\exshell.psc1″
Loads the specified Windows PowerShell console file. To create a console file
(Change the path to the installation path of Exchange 2007 in your environment)

C:\Scripts\MailboxSizes.ps1
The path to the script.
(Change the path where you save the script)

When you try to run the script, you may receive an error “Client was not authenticated”.  You have to add the Exchange 2007 Server to an Relay Connector, so that this server can send e-mail without authentication. If you’ve done this and run the script, you’ll receive the following e-mail.

 

Free Exchange 2007 ebook

On the following site of Red-Gate you can download a free Exchange 2007 ebook, Sybex’s ‘Best of Exchange Server 2007′ gives you 350 pages on how to get the most out of Exchange 2007. Verry usefull when you are starting with Exchange 2007 and you want to learn quickly the ins and outs of Exchange 2007.

How to: unattend Exchange 2007 installation on Server 2008

In this post we are going to install Exchange 2007 SP1 unattend with the command prompt including the installation of Rollup 5.

First i’ve installed an virtual Windows 2008 x64 server. The nex step is to install all the prerequisites. So as I posted a few weeks ago, this can be done with two simple batch file.

       

       

You can install Exchange 2007 SP1 with the following commands, it saves you a lot of time!

“C:\TMP\Microsoft Exchange Server 2007 incl. Service Pack 1 x64\setup.com” /mode:install /roles:HT,CA,MB,MT /organizationname:E2K7
/targetdir:E:\Exchsvr /EnableErrorReporting /EnableLegacyOutlook

Let’s see what all these commands are:

“C:\TMP\Microsoft Exchange Server 2007 incl. Service Pack 1 x64\setup.com”
This is the path to the installation files of Exchange 2007. Don’t forget the quotes(“”) when there’s a space in the path.

/mode:install
This will put the command in install mode.

/roles:HT,CA,MB,MT
This are the different roles that will be installed.
HT = Hub Transport
CA = Client Access
MB = Mailbox
MT = Management Tools

/organizationname:E2K7
This is the name of the Exchange 2007 Organization. Don’t forget the quotes(“”) when there’s a space in the name.

/targetdir:E:\Exchsvr
This is the location where you want to install Exchange 2007. It prefered a different partition then the Operating System (OS).

/EnableErrorReporting
This enables a higher logging level through the Exchange 2007 setup process, so it will be easier to trouble shoot.

/EnableLegacyOutlook
If you’ve Outlook 2000 of 2003 clients in your environment, then you need to enable the LegacyOutlook. When you’re only have Outlook 2007 clients, this option can be deleted from the command.