Exchange 2010

Bulk import PST files – [updated] v1.1

Bulk import PST files – [updated] v1.1

Just wrote a basic script for importing PST files into mailboxes, that I want to share with the community.

It is designed to check for PST files in the specified folder. Based on the filenames (of the PST files) it then verifies that a mailbox can be found. This is done by using the filename and adding the @ character and the domain value into a string value. If there is a match, it returns a value of $True and the script continues with running the New-MailboxImportRequest cmdlet.

The script is written just as basic as it can, it provides much information about values and what’s going on.
The most recent updated script can be downloaded here

I hope this will help you to import the PST files into the mailboxes

Ps. Sorry for the word-wrap, see the script file instead of copy the script code below

Changelog
v1.1
– Updated the $name variable due to issues with filenames got trimmed away. Also added so that if errors exists, they will be sent to a errorlog. Thanks to Chris Steding!

# +=======================================================================
# | Blog: http://www.testlabs.se/blog
# | Twitter: @jonand82
# | =============================================
# | Filename: Import-PST v1.1.ps1
# |
# | CREATED BY: Jonas Andersson
# | FUNCTION: Imports PST files into mailboxes, matching on emailaddresses
# |
# | CHANGE LOG: 
# | v1.0 - 2013-09-18, *Created*
# | v1.1 - 2013-09-22, *Update of $name variable*
# |
# |    Required permissions (RBAC) Role: “Mailbox Import Export”, example: New-Managementroleassignment –Role “Mailbox Import Export” –User “Administrator”
# +=======================================================================

# Load snapin
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction 'SilentlyContinue'

# Variables
$error.clear()
$errorlog = "C:\temp\errorlog.txt"
$pstpath = "C:\temp"
$domain = "testlabs.se"
$servername = "tlex01"
$files = Get-ChildItem -Path $pstpath -Filter *.pst

Write-Host $files

if (($files -ne $null) -or ($files -eq "")) {

    foreach ($i in $files) {

        $name = $i.BaseName
        $id = $name + "@" + $domain
        $filename = $i.FullName
        $filename = $filename.Replace(":","$")
        $uncfilepath = "\\" + $servername + "\" + $filename

        Write-Host "#################################################################"
        Write-Host "Filename:" $i -ForegroundColor 'Cyan'
        Write-Host "UNC path:" $uncfilepath -ForegroundColor 'DarkCyan'
        Write-Host "Emailaddress:" $id -ForegroundColor 'DarkGreen'

        $MailboxExists = [bool](Get-Mailbox -Identity $id -ErrorAction SilentlyContinue)

        if ($MailboxExists -eq $false)
        {
            Write-Host "Found mailbox:" $MailboxExists -ForegroundColor 'Red'
            Write-Host "Make sure to match filename to mailaddress, without @domain" -ForegroundColor 'Red'

        }

        if ($MailboxExists -eq $true)
        {
            Write-Host "Found mailbox:" $MailboxExists -ForegroundColor 'Green'
            Write-Host "Importing $uncfilepath into mailbox: $id" -ForegroundColor 'White'

            New-MailboxImportRequest -Mailbox $id -FilePath $uncfilepath

        }

        Write-Host ""
    }

}

else
{
    Write-Host "No PST files found"
}

if ($error -ne $null)
{
    $error | Out-File -FilePath $errorlog -Append
    Write-Host "See $errorlog for errors" -ForegroundColor 'Red'
}
Exchange Server 2013 Preview – Part 4: Configure DAG, CAS Array and Public Folders

Exchange Server 2013 Preview – Part 4: Configure DAG, CAS Array and Public Folders

In this series of posts, you can read about the fresh release of Exchange 2013 beta/Preview.
The posts are done as “how-to” posts with configuration examples from both Exchange Administration Console (EAC) and Exchange Management Shell (EMS).

Earlier parts can be found below:

Part 1: Installation guide
Part 2: Basic configuration
Part 3: Continue of configuration, URL’s etc.

At the end of the post, I will link to some interesting TechNet articles around High Availability, Disaster Recovery, Site resilience and Public Folder migration.

Note: My posts around Exchange 2013 Preview/beta are based on Beta information and it could be changed before it will be released (RTM).

Database Availability Group (DAG)

If this expression is new to you, here are some background information.
The DAG is the new cluster technology from Exchange 2010 and also included in 2013. It give us the opportunity to have a mailbox database replicated between two or more servers, the DAG can have utilize up to 16 copies of each database (16 different servers). The advantage of this is that if one server fails, it’s easy and very fast for doing switchover/failover to another server.

Some interesting changes around databases are that each database runs under it’s own process in Windows. Store (ESE) is totally rewritten, again.. which means you can’t use databases from older versions of Exchange directly on Exchange 2013. I have also read that IOPS requirements for databases have been reduced with another 50% from Exchange 2010, but I haven’t read it officially so maybe it’s just a rumor. We’ll see what happens when it’s being release and probably Microsoft will release an update mailbox calculator.

DAG is available for both Standard and Enterprise version of Exchange, and supported to run on both Windows 2008 R2 and Windows Server 8. Though all DAG members needs to run the same OS version.

Let’s get ready to create the DAG and add the Databases as copies on each DAG member/node.

Using EAC: It’s time to like the new EAC “console”.

Running “ipconfig” on both mailbox servers, for checking the IP addresses. Both for the MAPI network and the Replication network.

image

image

Go into Control Panel and check the network interfaces,

image

Login to the EAC, go to Servers and select Database Availability Group. Press Add button (+).

image

Type in DAG name, Witness Server, Witness directory and DAG IP. Press Save.

image

When the DAG is created, select it and Press Edit. Check the option “Configure database availability group network manually”. Press Save.

image

It’s now time for adding the mailbox servers into the DAG, this by pressing “Manage membership” button.

image

Press the Add button (+) and add the mailbox servers.

image

Add the mailbox servers that should reside in the DAG. Press OK.

image

Press Save.

image

The configuration now gets saved, failover clustering was installed on mailbox servers. Press Close.

image

Next thing to do it the DAG Networks, as you can see in the right bottom corner, a network called “MapiDagNetwork” has been created. I want to have the control over these networks so I will create my own.
Start by pressing “New DAG Network”. I’m about to create two new networks.

image

I will give the first network a name like MAPI Network, and assign the Subnet to it where the clients are supposed to connect. Press Save.

image

My second network will be called Replication Network, since that it’s purpose and also assign it to the correct Subnet. Press Save.

image¨

Since we now have created those two network, let’s remove the automatic created one by pressing “Remove” button.

image

Press OK.

image

The MAPI Network is not supposed to be used as replication network, so let’s disable that function by pressing “Disable Replication” on the MAPI network. Press OK.

image

The DAG should now show two networks called MAPI and Replication. The MAPI Network should not be enabled for replication.

image

Final DAG configuration

The last step (just a recommendation) is to enable the DAC mode, this for preventing split brain syndrome. Which means that you end up with having same database mounted on two (or more) different servers. More info about DAC mode can be found on the link in the end of the post.

This can’t be done through EAC (maybe that will change to RTM). So let’s start up Exchange Management Shell (EMC).

Set-DatabaseAvailabilityGroup –Identity DAG01 –DatacenterActivationMode DagOnly

image

Database copies

On each mailbox database we now need to add a copy to another server for having the redundancy.

In the menu, go to Databases and select one database, then press the Add database copy button.

image

Specify mailbox server that at the moments doesn’t hold a copy of the database and add it by pressing the browse button. Press Save.

Note: In this menu you also have the option to configure lag time (if using lagging node).

image

The database now get’s copied (Seeding).

image

Then do the same procedure on all of your databases.

image

Press Close, when the operation is done.

image

Do the same procedure on all of your databases.

image

The seeding operation is running.

image

Press Close.

image

It might take a while (some minutes..) until it get’s Healthy and everything has been checked and verified.
In my test environment it took around 15min to be fine. It should look like the picture below when everything is completed.

image

Using PowerShell: The Web interface is nice to work with. But I prefer the PowerShell, because I have the full control over what’s going on.

Let’s start with creating the DAG by using the command below:

New-DatabaseAvailabilityGroup –Name DAG01 –WitnessServer TLCAS01 –WitnessDirectory C:\FSW_DAG01 –DatabaseAvailabilityGroupIpAddresses 172.16.1.15

Configure the DAG so that the networks can be manually configured:
Set-DatabaseAvailabilityGroup –Identity DAG01 –ManualDagNetworkConfiguration $True

Add the mailbox servers into the DAG:
Add-DatabaseAvailabilityGroupServer –Identity DAG01 –MailboxServer TLMB01
Add-DatabaseAvailabilityGroupServer –Identity DAG01 –MailboxServer TLMB02

Enable DAC mode for the DAG:
Set-DatabaseAvailabilityGroup –Identity DAG01 –DatacenterActivationMode DagOnly

List the DAG Networks:
Get-DatabaseAvailabilityGroupNetwork

Create two new DAG Networks, one for Mapi and one for Replication:
New-DatabaseAvailabilityGroupNetwork –DatabaseAvailabilityGroup DAG01 –Name Mapi –Description “Mapi Network” –ReplicationEnabled $False –Subnets “172.16.1.0/24”

New-DatabaseAvailabilityGroupNetwork –DatabaseAvailabilityGroup DAG01 –Name Replication –Description “Replication Network” –ReplicationEnabled $True –Subnets “10.0.0.0/8”

Remove the automated created network, it will not be used:
Remove-DatabaseAvailabilityGroupNetwork –Identity DAG01\MapiDagNetwork

image

image

image

Database copies

On each mailbox database we now need to add a copy to another server for having the redundancy.

Specify a mailbox server that at the moments doesn’t hold a copy of the database and add it by running the following commands.

Add-MailboxDatabaseCopy –Identity DB01 –MailboxServer TLMB02
Add-MailboxDatabaseCopy –Identity DB02 –MailboxServer TLMB02
Add-MailboxDatabaseCopy –Identity DB03 –MailboxServer TLMB02

image

Verify the replication status on each mailbox server:
Get-MailboxDatabaseCopyStatus –Server TLMB01
Get-MailboxDatabaseCopyStatus –Server TLMB02

image

Public Folders

The Public Folder databases are now gone, and transferred to “normal” mailboxes instead. The advantage of this is that the mailbox itself can now be replicated using DAG technology. This doesn’t mean that the public folder contents is replicated, it’s still required that you configure the public folder replication for the contents.

With “normal” mailbox I mean that they reside in the mailbox databases, just like user mailboxes does. However they can in someway be compared to shared and room, those are also special mailboxes.

If you decide to use the Public Folders in Exchange 2013, the first step will be to create a mailbox that holds the public folder hierarchy. This will be the writeable copy, you can have copies of the hierarchy. But you can only have one that is allowed to make changes/writeable.

How can the hierarchy mailbox be created?

Using EAC: Go to Public Folders section, this is the first warning/error message you will receive.
It means that you don’t have any public folder hierarchy (mailbox) created yet.

image

Go to the second public folder selection called “Public Folders Mailboxes”. Add (+), create the first mailbox for the public folders, so it’s hierarchy can be saved.

image

Give the mailbox a friendly name, example: PF_Hierarchy, place it into an organizational unit and select a mailbox database where it should be saved into. Press Save.

image

Now when the hierarchy is created, let’s create some test folders too.
Go back to “Public Folders”, press the Add (+) button. Give the public folder a name. Press Save.

image

If you want to configure any storage quota on the public folder content, press Edit and configure it. Statistics can also be found under Edit selection, which sometimes is valuable.

image

Just for testing purposes I did mail-enable the folder. By pressing the Enable button.

image

Press Yes.

image

Let’s check the properties for the folder again, now we see that we have lots of new settings. Here’s a small example how the Mail Flow settings looks like.

image

Using PowerShell: Start up Exchange Management Shell, the following commands will be used for creating the public folder hierarchy and contents folder.

Create the hierarchy by running the following command
New-Mailbox –Name PF_Hierarchy –Alias PF_Hierarchy –Database DB01 –OrganizationalUnit Users

This mailbox, like shared/room mailboxes is also disabled by default. This for not having the possibility to logon as this user.

Let’s create the folder named Testlabs
New-PublicFolder –Name Testlabs

Finally, mail enable the public folder
Enable-MailPublicFolder –Identity \Testlabs

image

We have public folders located in Exchange 2007/2010, what about them?

In the end of this post, you can find a link to a TechNet article, it provides you with a great step-by-step guide. I haven’t tried to migrate public folder contents from earlier versions of Exchange since SP3 for Exchange 2010 is required for having coexistence between Exchange 2010 and Exchange 2013. SP3 is right now under development/testing and no official information can be found.

When I get my hands on SP3, this will be one of the first things to try out.

Client Access Server Array

In my previous blog post I did write about some news regarding MAPI and RPC, where I did mention what changes been made. It can be found here.

The “new” Client Access Server role can now been seen as more of a traditional Front-End server.
It utilize as a front-end connection point and redirects/proxies (depending on method) the clients to it’s correct mailbox server.

After the architectural change around the CAS role, it’s now “stateless” which means there’s no need for the load balancer to configure affinity/sticky session. For example, it means that the clients is not required to have the connection established to the same CAS server for having the OWA to work. This means that all CAS servers now will serve all clients with connections to it’s mailbox endpoint server.

How to create a client access array?

Right now, I don’t see any specific reason for creating the CAS Array, since the traffic will be proxied from the CAS servers to the correct active Mailbox servers.

In an upcoming blog post I will cover how to configure the load balancing for Exchange 2013.

Upcoming topics: load balancing Exchange 2013 using different load balancers, database fail-over, move mailbox reports, disaster recovery etc.

But first it’s time for 3 weeks of vacation, until then. Keep on reading the posts and you’re more than welcome to comment on them.

Thanks for reading, I hope it did gave you some valuable information.

More information:

High Availability
http://technet.microsoft.com/en-us/library/dd638137%28v=exchg.150%29.aspx

DAC mode
http://technet.microsoft.com/en-us/library/dd979790.aspx

Client Access Server
http://technet.microsoft.com/en-us/library/dd298114%28v=exchg.150%29

Public Folder migration scenario
http://technet.microsoft.com/en-us/library/jj150486%28v=exchg.150%29

Traditional Backups using DPM 2012 for Exchange 2010 SP2

Traditional Backups using DPM 2012 for Exchange 2010 SP2

Last week I posted how to restore using EMC, this time it’s up to proof that DPM 2012 (System Center Data Protection Manager) is a software to count on. So here’s a step-by-step guide how DPM 2012 can be configured for backing/protecting Exchange 2010.

I’m using a Windows 2008 R2 for the DPM server together with a 50 GB disk for the backup data (I have small Exchange databases).

Start “System Center 2012 DPM Administrator Console”.

Prerequisites

Note: Make sure to not use circular logging, or else the protection/backups won’t work.

Step 1. Go to the “Monitoring” section and have a look, it looks pretty much the same as DPM 2010 did.

image

Step 2. Go to “Management” section and and take a look at the disks, I’ve added my 50GB disk by pressing the “Disks” and then press the “Add” button and selecting the disk. After that it should show up just like the picture below.

image

Step 3. Press “Agents” in the Management section, then press the “Install” button and you will have a nice wizard helping you. Since my Exchange server is in the same domain as the DPM server and no firewalls between, I did select “Install agents”. Press Next.

image

Step 4. Select the server you want to backup/protect and press “Add” button. Press Next.

image

Step 5. Make sure to insert credentials that have necessary permissions for being allowed to install the agent (local administrator rights).

image

Step 6. Since I want to restart the server myself and have the full control, I did select “No. I will restart the selected computers later.” Press Next.

image

Installation progress will be shown.

image

When the agent installation is completed, it should show the status in “Management” section and “Agents”.

image

Now when the prerequisites are in place, we can proceed with the protection groups creation.

Protect/Backup Exchange 2010

Step 1. Go to “Protection” section and press “New” in the upper left corner and a wizard will start.

image

Step 2. Press Next.

image

Step 3. Select Servers. Press Next.

image

Step 4. Select the server/DAG and the databases you want to protect. Press Next.

image

Step 5. Give the Protection Group a friendly name. Press Next.

image

Step 6. I want DPM to verify the data integrity, put a checkbox in the option “Run Eseutil to check data integrity” and select “Run for both database and log files (maybe slow if databases are large)”. Press Next.

Note: Make sure to copy the “Ese.dll” and “Eseutil.exe” files from \bin folder from Exchange server into the DPM server folder “\DPM\bin\”. Or else this won’t be possible and an error message like below will show up.

image

image

Step 7. The selected databases shows up, I want to have full copy of them so I’m going with the default setting. Press Next.

image

Step 8. Specify how long the backup data should be retained and how often it should do incremental/synchronization backup, also specify when you want the full backups to run. Press Next.

image

Step 9. A summary is showed of data size, modifications can be done. I’ll go for the default settings. Press Next.

image

Step 10. I want DPM to take a full replica right now. Press Next.

image

Step 11. I’ve selected both options and wants my consistency check to run at 12:00 with a maximum duration of 168 hours (1 week). Press Next.

image

Step 12. Summary of settings is shown. Press “Create Group”.

image

After a while, the status should be Successful. Press Close button.

image

When the wizard is completed, the job for taking full replica starts, below is some example pictures.

image

image

Every 15min my setup is doing an incremental backup, in the “Protection” section it shows when it’s running.

image

Have a look in the reports to see how things are going, go to “Reporting” section and select a report you are interest in, I have selected “Recovery Point Status”. A small example of it is shown below.

Those reports can be scheduled and emailed very easy.

image

Next blog post will be how to restore / recover data using DPM 2012 for Exchange 2010.

Thanks for reading and don’t forget to leave a comment

Exchange 2010 Restore to Recovery Database using EMC Networker

Exchange 2010 Restore to Recovery Database using EMC Networker

Published: 2012-07-05
Updated: –
Version: 1.0

Here’s a complete step-by-step guide for doing restore using EMC Networker for Exchange 2010.
Personally I’ve used these steps when doing restore of end user mailbox and/or items that has been lost.

Start up “Networker User for Microsoft Applications”, right click Recover and select “Exchange 2010 Recover Session” and select “Database Recover”.

Make sure that the Client selection is pointed to the DAG or specific server.

After a while it will show Microsoft Exchange 2010 and the databases below, right click the database you want to restore and select “Versions”.

image

Select the date you want to restore from and put a checkbox in “Use selected item backup time as new browse time”. Press OK.

image

Check so that the database and logs are selected and press “Advance Recover..”

image

Control so that the source database is correct and that “Recovery Database (RDB) Recovery” is selected. Press Next.

image

Press the Create button.

image

Make sure that you have sufficient amount of free disk space before starting the restore.
Save the edb/database file in a folder and give it a friendly name. Press Save.

image

Give the RDB a friendly name and press Create.

image

RDB is created successfully.

image

When the RDB is created, mount it by pressing Mount button.

image

Mounted successfully.

image

Press the “RDB Overwrite” button for making sure that Networker is allowed to overwrite the RDB.

image

Press Next.

image

Check the summary and press “Start Recover”.

image

You can monitor the restore process by going to “Monitor” on the left side. It will show information about the restore.

image

When the restore is completed, it will notify with a window like this.

image

The last step before everything is restored is to merge/copy the data from the RDB into a mailbox.
I’m using the command “Restore-Mailbox”

The command below is an example from my restore, it restores the mailbox called “LostMailbox” into my mailbox called “Jonas” and puts the contents into a folder called “Recovery”:

Restore-Mailbox –Identity Jonas –RecoveryDatabase RDB –RecoveryMailbox LostMailbox –TargetFolder Recovery

Then it’s pretty easy to use Outlook and move the contents to the correct mailbox, or else put the contents directly into the right mailbox. It’s up to you!

Source: http://technet.microsoft.com/en-us/library/bb125218.aspx

Exchange 2010 SP2 Update Rollup 3

It was release yesterday, and I was hoping that it should include the upcoming hotfix for ActiveSync devices regarding the behavior for redirections.

But it was not included this time, anyway.. Here’s the team blog, download link and description about the update rollup.

http://blogs.technet.com/b/exchange/archive/2012/05/29/released-update-rollup-3-for-exchange-2010-service-pack-2.aspx

http://www.microsoft.com/en-us/download/details.aspx?id=29899

http://support.microsoft.com/kb/2685289

Quote from team blog:

Note for Forefront Protection for Exchange users  For those of you running Forefront Protection for Exchange, be sure you perform these important steps from the command line in the Forefront directory before and after this rollup’s installation process. Without these steps, Exchange services for Information Store and Transport will not start after you apply this update. Before installing the update, disable ForeFront by using this command: fscutility /disable. After installing the update, re-enable ForeFront by running fscutility /enable.

Configure Microsoft Exchange Server 2010 SP2 with Microsoft Federation Gateway

Configure Microsoft Exchange Server 2010 SP2 with Microsoft Federation Gateway

 

Since the topic around configuring Federation using Microsoft Federation Gateway is not very clear in the documentation I decided to create a post around it.
The confusion came when SP2 was released for Exchange 2010.
One article says one thing and another says something else, things have changed after SP2, that’s why I’m posting this even if there were articles around this for SP1 (see links in the end).

Basic facts: You don’t need to create any sub-domain, it’s done and used only by Exchange itself.

Prerequisites:

You need to open up so that the server is able to reach Internet during the creation of the Federation.
Or else you will have this error message.

image

More information (read about the prereqs):
http://technet.microsoft.com/en-us/library/dd335198.aspx

 

 

Step 1.

The most basic way for creating the Federation trust is to use the EMC.
Go to “Organization Configuration” and select tab “Federation Trust”.
Press the “New Federation Trust” button and the wizard will launch.

image

image

 

 

Step 2.

You will need to run the command below for every domain you want to federate.
Copy the value from the “Proof” field and add it into a TXT record for the public DNS zone.
This is the unique value that the Federation Gateway Service is using to identify and verify.

“Get-FederatedDomainProof –DomainName testlabs.se”

image

 

 

Step 3.

For each domain you want to federate you will need to create a TXT record including the corresponding “Proof” value into.
(In my case I’m just federating one domain).

Create the TXT record in the public DNS zone.
It should look like this when the record has been created.

Let’s take a look in the public DNS using “nslookup”.

image

 

Below is an example on you create a TXT record in the Windows DNS.

Start the DNS Management tool
Select the public DNS zone
Right click the DNS zone and select “Other New Records..”
Choose the “Text (TXT)” type and press “Create Record..”
Then insert the text string into the Text field and press “OK”.

image

 

 

Step 4.

 

Now it’s time for completing the federation steps, we need to add the domain so it’s actually federated.
This is done by using the EMC, go to Organization Configuration and select the tab “Federation Trust”.
Select the “Microsoft Federation Gateway” and press “Manage Federation..”

image

 

In the wizard you can check so that the self-signed certificate (used for federation purpose only) is distributed to all Exchange servers.
Then press “Next”

image

 

Now select the domain you want to federate, in my case it’s “testlabs.se”, and press “OK”.

image

 

Type in the organizational contact for this domain and make sure that the checkbox for “Enable federation” is selected.

image

image

 

In the EMC it should now show the “Application Identifier” and “Application URI” values.
Those values were empty before.

image

 

 

Step 5.

The last step around the Federation is to make sure that the Autodiscover function is working since it’s used for finding and checking the FreeBusy information.
First thing to make sure of is that it’s published in the public DNS zone, when it’s published it should look like the picture below.

Autodiscover must be reachable from Outside/External and this is also done per domain, so for each domain you want to federate this must be done.

image

 

Below is an example on you create a Alias/CNAME record in the Windows DNS.

Start the DNS Management tool
Select the public DNS zone
Right click the DNS zone and select “New Alias (CNAME)..”
In the “Alias name” field type in Autodiscover and in the FQDN value browse for the server/name that’s used for Autodiscover
Press “OK”

image

 

For publishing Autodiscover using TMG, check this article:
http://www.testlabs.se/blog/2010/07/27/how-to-publish-owaactivesyncoutlook-anywhere-exchange-2010-with-microsoft-forefront-tmg-2/

 

 

Step 6.

The last and final step for accomplish the sharing of FreeBusy information is to create the Organization Relationship.

Go to “Organization Configuration” and select tab “Organizational Relationships”.
Press the “New Organizational Relationship..” button and the wizard will launch.

For details around which relationship you should choose, read the link below:
http://technet.microsoft.com/en-us/library/dd351260.aspx

 

If you want to specify which users that should be able to use this federation feature, this can be done by specifying a security distribution group.

image

 

Next step is to type in the organization you will be able for sharing the information with.
This can be done either by using Autodiscover (first option) or manually typing in the “Application URI” and “Autodiscover endpoint”.

image

 

 

Notice: This article is based on Exchange 2010 SP2

 

 

Sources:

http://technet.microsoft.com/en-us/library/ff601760.aspx

http://www.stevieg.org/2010/08/federation-onpremise-outlooklive/

http://www.expta.com/2011/07/how-to-configure-exchange-2010-sp1.html

C#.NET – Configure Exchange 2010 Tool

C#.NET – Configure Exchange 2010 Tool

======

Updated the code again, this time a minor bug in code.
Version is now 0.93.

======

Thanks to John A Cook @JohnACook, who found the issue. It’s now resolved, the tool is now updated and working in my lab environment.
It was a compilation issue, found out that it was compiled as a x86 tool. Sorry for that folks! Thanks a lot for helping me out

======

Download

ChangeLog:
0.93 – Updated minor bug in code
0.92 – Fixed the compile issue.
0.91 – The tool has now been updated to version 0.91, this update fixed if URL’s was not configured/null.

Description:

A while ago I was having this idea of creating a tool that configure the most common things on the Exchange server(s).

It took about 3-4 weeks to complete the application with all coding, which includes around 3000 lines in total.

The tool should be used locally on the server, since it’s using the Exchange PowerShell snapin when doing the query’s and configuring parts.

Besides the smaller parts that uses PowerShell the application is built on C#.NET.

Before going into detail, at the moment it’s version 0.9 since I’m about to optimize the code a bit more. I will update the blog post when it’s done.
Until then, use it as much you want and feel free to give any feedback (it’s great to get feedback).

The debugging of the application has been done on Exchange 2010 SP2, that’s the version it’s built for. But most likely it will work on RTM newer.

Description:

The tool will give you the opportunity to configure the following Exchange features:

Autodiscover, Outlook Web App, Active Sync, Web Services, Control Panel, Offline Address Book, POP/IMAP and Outlook Anywhere.

Check the screenshots below:

imageimageimage

All functions are built upon a query is done first and then it’s possible the change the current settings using the “Set” button.

The first tab is for configuring the Autodiscover SCP settings (Get-ClientAccessServer).
Press the Query button for requesting the current setting, and then you’re able to change it by editing the text and press “Set” button.

The second tab it for set the Internal and ExternalUrl for Outlook Web App, and also for the Logon format.

Third tab is used for Exchange ActiveSync, it’s possible to set the Internal and ExternalUrl and also set the Basic Authentication setting.

Fourth tab is for Exchange Web Services, Internal and ExternalUrl is about to be configured.

Fifth, Exchange Control Panel settings; Internal and ExternalUrl.

Sixth, Offline Address Book settings; Internal and ExternalUrl.

Seventh, POP and IMAP settings, it’s possible to change the Logintype, X509 name and set the Service to Automatic and Start it.

Eighth and final tab, Outlook Anywhere configuration, External hostname and what authentication setting is possible to change here.

About tab, it speaks for it self. Information about the small application

Note: The first query take some time, since it’s loading the snapin. Have some patience, but after the first one it should be pretty fast.

Download the application from here

Like I initially said I will do some code optimization, and will be updating this blog post when it’s done.
Feel free to leave comments, it’s always a pleasure to read them!

Ps. Use the application/code/scripts at your own risk. Test in lab environment first.

Thanks for reading

C#.NET – Create Mailboxes

C#.NET – Create Mailboxes

Updated:

Version 1.0.1 is released

I’ve added the possibility to create Room, Equipment and Shared Mailboxes.
The zip file with the application is now updated, one CSV example file is included.

=====

This is my 3rd C#.Net application, this one is creating mailboxes based on CSV file (semi colon separated).

I’m using FileHelpers for reading the CSV file, this dll file is embedded into the exe file for easier handle.

The application is using remote PowerShell, so make sure that you have enabled remote PowerShell for the user that’s configured.
Follow this link: http://technet.microsoft.com/en-us/library/dd298084.aspx

The remote PowerShell connection mechanism is the default (Windows Auth) one.

Start with browsing for the CSV file, semi colon separated (;), then press the Load button for loading up the contents in the CSV file.
The items will be counted in the upper right corner.

Next step is to press the Verify button for checking so that the mailboxes doesn’t already exists.
If some of them already exist, the Create button will not be clickable.
If some mailbox already exists, make sure to edit the CSV file and load it again and then hit the Verify button.

When none of the listed mailboxes are found, the Create button will be clickable.

After the mailboxes has been created it will list them with UPN and Status (OK, Created).
If you want to be sure that they were created, press the Verify button for checking if they exist.

(Or search for them using EMC/EMS)

image

Feel free to use the application how much you want, use it at your own risk and I don’t do any kind of support for it.

The application can be downloaded here.
CSV file example is included.

Thanks for reading

Selected PowerShell commands, output to CSV file

Selected PowerShell commands, output to CSV file

Here’s a sample on a basic PowerShell script that combines Get-Mailbox, Get-User and Get-MailboxStatistics commands.

The specified objects will be saved into a CSV file.

You can download the script here.

I would be more than happy for any kind of comment or feedback
Feel free to use the script below


#############################################################################
 # PS-Merge.ps1
 # Description:
 # This script combines three commands and sends the output into a CSV file
 #
 # Jonas Andersson, MCC 2011
 # http://www.testlabs.se/blog
 # Twitter @jonand82
 #############################################################################

#Add Exchange Management Snap-In to recognize Exchange CmdLets in PowerShell
 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue

$Database = @{Name="Database";Expression={ $stats.database }}
 $DisplayName = @{Name="DisplayName";Expression={ $stats.DisplayName }}
 $StorageLimitStatus = @{Name="StorageLimitStatus";Expression={ $stats.StorageLimitStatus }}
 $TotalItemSize = @{Name="MailboxSize";Expression={ $stats.TotalItemSize }}
 $Company = @{Name="Company";Expression={ $user.Company}}
 $FirstName = @{Name="FirstName";Expression={ $user.FirstName}}
 $LastName = @{Name="LastName";Expression={ $user.LastName}}
 $LastLogon = @{Name="LastLogon";Expression={ $stats.LastLoggedOnUserAccount}}
 $LastLogonTime = @{Name="LastLogonTime";Expression={ $stats.LastLogonTime}}

$Mailboxes = Get-Mailbox -ResultSize Unlimited
 $Mailboxes | foreach {
 $user = Get-User $_
 $stats = Get-MailboxStatistics $_
 $_ | select Alias,SamAccountName,$DisplayName,$FirstName,$LastName,$LastLogon,$LastLogonTime,$Company,*SMTP*,$Database,$StorageLimitStatus,$TotalItemSize,RecipientTypeDetails
 } | Export-CSV -NoTypeInformation C:\output.csv

C#.NET – List all mailboxes

C#.NET – List all mailboxes

Since I promised to put the source code and the application here on the blog, so here it is.

The source code can be downloaded here.

It’s not any kind of advanced application, it lists all mailboxes in the environment it’s connected to.
The connection is done by using Remote PowerShell and can be configured in the Settings tab.

The importance to get the application working is to have Remote PowerShell configured for the connecting user.
And don’t forget if you’re using HTTPS the certificate names needs to be in place, or else it won’t work.

Feel free to use the code and customize it.
Just notify me or have a link the my blog.

There is a barrier before getting started and really learn and understand C#.Net so I want to thank Peter Ericsson, Martin Sundström and Mike Pfeiffer for some kind tips and tricks.
(Press their names for being redirected to their blogs.)

Thanks for your help

Load More