Archive for the ‘Exchange Server’ Category

Exchange 2010 Mailbox Move Status Script

Saturday, May 14th, 2011

2011-05-14 Updated

2011-05-04 Initial Post

This is my first real PowerShell script. I'm starting to do a lot more with PowerShell now and eventually I'd like to get good enough to write some functions.

I wanted more information such as mailbox size and move duration so I searched and found the cmdlet Get-MoveRequestStatistics. That gave me what I needed so I rewrote my original script.

#Last modified by SysAdmin-E.com, 2011-05-09
$strScriptVersion = "Script version: getMailboxMoveStat-v1.2.ps1, updated 2011-05-09`n--End of Script--"
<#
Gets mailbox move request statistics and e-mails it out. Also copies to CSV file in D:\MailboxMoveStatistics\ on the server running the script.
NOTE: This script looks for mailbox move requests. If you clear all the move requests, this script will not find anything. Clear the move requests only before and after running this script to get the most accurate count.
To schedule, use this command (adjust path and version number first): powershell -command "& 'C:\_AdminScripts\getMailboxMoveStat-vX.X.ps1'"
I kept getting this error: Task Scheduler failed to start "\getMailboxMoveStat" task for user "AD-DOMAIN\USERNAME". Additional Data: Error Value: 2147750687.
 I had to go to the task's Settings tab and select either "Run a new instance in parallel" or "Stop the existing instance."
Tested with PS v2 with Exchange Server 2010 SP1 on Windows Server 2008 R2 SP1.
Use a Hub server for the SMTP host. A MB or CAS server does not have an SMTP service.
NOTE: When viewing the e-mail, Outlook might remove extra line breaks (`n), by default, so deselect that option in Outlook.
#>
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$strDateTimeLong = Get-Date -Format F
$strDateTimeShort = Get-Date -Format yyyy-MM-dd-HH-mm
#Change file path below.
$strFileOutputPath = "D:\MailboxMoveStatistics\MailboxMoveStatistics_$strDateTimeShort.csv"
#Command below is for exporting the information to CSV. Rearrange the column names to your liking.
Get-MoveRequest -ResultSize Unlimited | Get-MoveRequestStatistics | Select Status, PercentComplete, DisplayName, Alias, TotalInProgressDuration, TargetDatabase, SourceDatabase, TotalMailboxSize, TotalMailboxItemCount, BadItemsEncountered, StartTimestamp, CompletionTimestamp, MRSServerName | Sort Status -Descending | Export-Csv $strFileOutputPath -NoTypeInformation
$strStatusCount = "Completed: " + (Get-MoveRequest | Where {$_.Status -eq "Completed" }).Count + ", Total Move Requests: " + (Get-MoveRequest).Count + ".`n"
$strCmdForEmailBody = Get-MoveRequest -ResultSize Unlimited | Get-MoveRequestStatistics | Select Status, PercentComplete, DisplayName | Sort Status -Descending | FT -AutoSize | Out-String
#Change SMTP server below.
$strSmtpServer = "exchange-01"
#Change e-mail sender below.
$strSmtpSender = "Exchange 2010 Mailbox Move Statistics <SysAdmin-E.com@SysAdmin-E.com>"
#Change e-mail recipient(s) below.
$strSmtpRecipient = "someone@SysAdmin-E.com"
$strSmtpSubject = "Exchange 2010 Mailbox Move Statistics - $strDateTimeLong"
$strSmtpBody = $strStatusCount + "A more detailed report is in the file $strFileOutputPath on $env:computername.`n"
$strSmtpBody = $strSmtpBody + $strCmdForEmailBody + $strScriptVersion
$objSmtpClient = New-Object System.Net.Mail.SmtpClient
$objSmtpClient.Host = $strSmtpServer
$objSmtpClient.Send($strSmtpSender, $strSmtpRecipient, $strSmtpSubject, $strSmtpBody)
Exit

ActiveSync – Find Enabled Users via msExchOmaAdminWirelessEnable Attribute

Saturday, February 12th, 2011

2011-02-14 Updated

2011-02-12 Initial Post

Windows Server 2003 SP2

Exchange Server 2003 SP2

In the IT business, sometimes what seems like a simple question can result in a few hours of work to get a satisfactory answer. The other day I was asked to look at why a query for all ActiveSync enabled users wasn't returning the correct results. The query was using the msExchOmaAdminWirelessEnable attribute. That attribute holds the values for the settings under user properties --> Exchange Features tab --> Mobile Services. (more…)

Public Folder Replication and Message Size Limits

Sunday, January 30th, 2011

2011-01-29 Initial Post

Windows Server 2003 SP2
Exchange Server 2003 SP2

I was working on an issue where a PF wasn't replicating all of its content to another replica (there were only 2 replicas, each in a different routing group). There weren't any size limits on the folders or the PF stores on either server. I read a few PF replication troubleshooting articles and didn't really come up with a solution from reading then, although I did learn a lot about the PF replication process. (more…)

Public Folder – Move to Different Location

Tuesday, January 18th, 2011

2011-01-15

Exchange Server 2003 SP2, Windows Server 2003 SP2, Outlook 2007 SP1

Tested with one single PF only. Moving a PF tree should be the same.

You can move a PF from one location to another location using Outlook. The move is instantaneous since it just repoints the PF, unlike a move of a regular file system folder which would be a copy and then delete operation. The person doing the move must have the proper permissions to source and destination PFs.

E-mail settings and folder rules are all kept intact. Permissions (MAPI and directory) are kept intact as well and the moved PF will not inherit the new parent folder's permissions.

Exchange Server 2003 – Active Directory Modifications

Saturday, January 15th, 2011

2011-01-21 Updated

2011-01-15 Initial Post

I know Exchange Server 2003 is old by now, but the client I work for still uses it, so I had set up my own test environment at home. I've worked with Exchange since 5.5, so it's not new to me. I'm also certified on Exchange Server 2007, so I'm up-to-date on the current versions.

I'm posting these screenshots and notes up here for reference. These show some of the AD modifications that are made when Exchange is installed/AD prepared. Exchange Server 2007 and 2010 basically modify AD the same way, so this is good to know. Here's a good article on what ForestPrep and DomainPrep do to AD. Note that in Exchange Server 2007 and 2010, ForesPrep and DomainPrep are no longer used, and PrepareSchema and PrepareAD are used instead. (more…)