Tuesday, 13 March 2012

More Exchange Powershell Scripts

Our exchange 2010 environment was set up by an external company. Unfortunately for us, there was no technical hand over, so we had to go about figuring how it has been set up for ourselves.

Here are another couple of commands to give us information about Public Folders.

This produced a list of mailbox databases and their corresponding public folder database excluding the archive databases.

Get-MailboxDatabase | select name, Publicfolderdatabase | where {$_.name -notlike "*Arch*"}

Using Get-PublicFolderDatabase we were then able to see which servers hosted which public folder database.

Tuesday, 6 March 2012

PowerShell Scripts used in exchange Migration

We've been recently migrating users from an Exchange 2003 environment to Exchange 2010 SP2. We have been using powershell for the most of it along with Opalis. Here are some command's we found useful.

Resume any suspended move requests.
Get-MoveRequest -MoveStatus Suspended | Resume-MoveRequest -confirm:$false

Delete any completed move requests
Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest -confirm:$false

Create a new move request (We used this for any mop ups we had to do due to incorrect email addresses fed into our Opalis workflow)
New-MoveRequest -Identity <username> -BadItemLimit 50 -Suspend:$true

If we didn't want a database to be included in the automatic distribution of mailboxes we ran this command
Set-MailboxDatabase DB01 -IssuspendedFromProvisioning $True

To get the status of our databases after a migration. We didn't want to include the archive databases so we filtered them out.
get-mailboxdatabase -status | select servername,name,databasesize | where {$_.name -notlike "*Arch*"}

And lastly to get the number of mailboxes per database we run the following script

(Get-MailboxDatabase) | where {$_.name -notlike "*Arch*"} | ForEach-Object {Write-Host $_.Name (Get-Mailbox -Database $_.Name).Count}