Monthly Archives: August 2010

Mailbox Archive Tool for Microsoft Exchange Servers

Written by Tao Yang

This is another GUI tool based on PowerShell I’ve written in the past.

A company I worked for needed a tool for Service Desk people to archive users’ mailboxes into PST file. I’m not an Exchange engineer, they told me they used to use ExMerge in Exchange 2003 environment but since upgraded to Exchange 2007,  they were no longer able to do so under a GUI interface because ExMerge was replaced by a PowerShell cmdlet “Export-MailBox”.

So I wrote this mailbox archive tool. it basically archives a mailbox into a PST file (with the option to whether delete mailbox after archiving):

Screenshot

This tool has been tested and it is working in both Exchange 2007 and 2010 environment.

Prerequisites:

Exchange 2007 Exchange 2010
32 bit Operating System 64 bit Operating System
Outlook 2007 64 bit Outlook 2010
32 bit Exchange 2007 Management Tools Exchange 2010 Management Tools
Windows PowerShell Windows PowerShell

Setup operators permissions (Below powershell commands use “Domain\Exchange Operators Group” as an example):

  • add-ExchangeAdministrator -Identity “Domain\Exchange Operators Group” -Role ViewOnlyAdmin -confirm:$false
  • $mailDBs = Get-MailboxDatabase | where {$_.StorageGroup -match “Storage Group”}
  • $mailDBs | add-adpermission -User “Domain\Exchange Operators Group” -AccessRights WriteOwner,WriteDacl -extendedrights ms-Exch-Store-Admin

Instructions:

  1. Logon to the computer using an account that’s been setup to have the appropriate rights.
  2. Launch the tool using the shortcut: (Note, I’ve hard coded the path in the shortcut to C:\Scripts\Mail-Archive. please modify the shortcut if required)image
  3. Enter the mailbox and specify PST file location, choose “Delete after export” if desired.
  4. Click “Run” to begin archiving.
  5. output and logs are displayed on the output pane.
  6. Locate the PST file after it’s donepst
  7. Logs are also created for each export under the log folder:image
  8. Note if export failed because it has reached bad item limit, you can change the threshold in MailArchiveConfig.ini. I’ve set it to 1000, increase it if you like.

Balancing Number of SCOM Agent Per Management Server using PowerShell

Written by Tao Yang

I came across a situation yesterday in one of the clients SCOM environment:

They currently have a single SCOM management group setup as the following:

Drawing2

  1. all SCOM management servers (including the root management server) are located on the same segment of the network.
  2. internal agents (from the same forest) are reporting to management server #1 and #2.
  3. External agents (from different forests) are reporting to management server #3 and #4 through firewall.
  4. SCOM is not integrated to AD – Therefore primary and failover management servers are not automatically assigned to agents.

I needed to achieve:

  1. agents are evenly distributed to the Internal and external management servers.
  2. all other management servers in the same group are assigned as failover management servers.
  3. For Example, there are 513 agent managed computers in internal network. They need to be evenly spread between management server #1 and #2 (so one management server will have 256 agents and the other will have 257 agents). All agents hanging off management server #1 will have #2 assigned as failover management server and vice versa.

I wrote this PowerShell script for this task. if you create a Windows scheduled task and run it on a regular basis, you’ll ensure all your SCOM agents are evenly assigned to a group of management servers and have correct settings for failover management servers.

The script does so by doing the following:

  1. Work out total number of agents that are currently hanging off the management servers specified in the script (line 33-37):image
  2. Work out which management servers are over average and which ones are below average
  3. Go through each one that’s over the average, move agents to another random management server until it reaches the average number.
  4. after each agent move, check the destination management server, make sure it is still under the average number, otherwise, remove it from the pool of under average management servers.
  5. Go through the remaining agents on each management server and make sure they are set to use all the other management servers as failover management servers.

Note: PowerShell Version 2 is required to run this script! This script can only run on the root management server. if you want to run it somewhere else, please modify line 15 of the script to have the correct FQDN of your RMS server.

Passed MCTS SCCM exam yesterday

Written by Tao Yang

Passed Exam!
In the last couple of weeks, I’ve been refreshing my memory on SCCM since I haven’t worked on it for almost 4 month… Yesterday, I passed Microsoft 70-401 (SCCM) exam with the score of 976/1000. Pretty disappointed that didn’t get 1000 though…

Oh well, there are some SCCM work coming up at work, can’t wait to get started!