Thursday, December 3, 2009

Problem Removing Recovery Storage Group After a Restore

Probably just a minor bug in the Exchange Console GUI (SP1 w/ hotfix rollup 7), but I found myself unable to remove the recovery storage group after a restore. I dismounted the database (which reported a successful completion), but when I attempted to remove the storage group, the console complained that the database must first be dismounted. Switching to the shell, I ran the following command…

Remove-MailboxDatabase -Identity "mailbox-server\recovery storage group\restoreddatabase" -verbose

… which produced the following output:

VERBOSE: Remove-MailboxDatabase : Beginning processing.
VERBOSE: Remove-MailboxDatabase : Administrator Active Directory session settings are:  View Entire Forest:
'False', Default Scope: 'mydomain.pvt', Configuration Domain Controller: ‘mydc.mydomain.pvt',
VERBOSE: Remove-MailboxDatabase : Searching objects "mailbox-server\recovery storage group\restoreddatabase" of type
"MailboxDatabase" under the root "$null".
VERBOSE: Remove-MailboxDatabase : Previous operation run on domain controller 'mydc.mydomain.pvt'.
VERBOSE: Remove-MailboxDatabase : Establishing the Admin RPC connection with Server
"mailbox-server.mydomain.pvt".
VERBOSE: Remove-MailboxDatabase : Checking the status of database "mailbox-server\Recovery Storage
Group\restoreddatabase".

Confirm
Are you sure you want to perform this action?
Removing Mailbox Database "mailbox-server\recovery storage group\restoreddatabase".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

Pressing enter to accept the default [Y] response yields this:

VERBOSE: Remove-MailboxDatabase : Establishing the Admin RPC connection with Server
"mailbox-server.mydomain.pvt".
VERBOSE: Remove-MailboxDatabase : Checking the status of database "mailbox-server\Recovery Storage Group\restoreddatabase".
VERBOSE: Remove-MailboxDatabase : Taking cluster resource of database "mailbox-server\Recovery Storage Group\restoreddatabase" offline on server "mailbox-server".
VERBOSE: Remove-MailboxDatabase : Checking the status of database "mailbox-server\Recovery Storage Group\restoreddatabase".
VERBOSE: Remove-MailboxDatabase : Searching objects "mailbox-server\Recovery Storage Group" of type "StorageGroup" under the root "$null".
VERBOSE: Remove-MailboxDatabase : Previous operation run on domain controller 'mydc.mydomain.pvt'.
VERBOSE: Remove-MailboxDatabase : Dismounting the database, "mailbox-server\recovery storage group\restoreddatabase".
VERBOSE: Remove-MailboxDatabase : Searching objects "mydomain.pvt/Microsoft Exchange System
Objects/SystemMailbox{021114f7-3b45-464c-bffd-c5c9821aabbb}" of type "ADRecipient" under the root "$null".
VERBOSE: Remove-MailboxDatabase : Previous operation run on domain controller 'mydc.mydomain.pvt'.
VERBOSE: Remove-MailboxDatabase : Deleting "mailbox-server\Recovery Storage Group\restoreddatabase" of type
"MailboxDatabase".
VERBOSE: Remove-MailboxDatabase : Previous operation run on domain controller 'mydc.mydomain.pvt'.
WARNING: The specified database has been removed. You must remove the database file located in H:\MyStorageGroup\RSG20091202084953\restoreddatabase.edb from your computer manually if it exists. Specified database:
restoreddatabase
VERBOSE: Remove-MailboxDatabase : Searching objects of type "MailboxDatabase" with filter "(OriginalDatabase Equal
021114f7-3b45-464c-bffd-c5c9821aabbb)", scope "SubTree" under the root "$null".
VERBOSE: Remove-MailboxDatabase : Previous operation run on domain controller 'mydc.mydomain.pvt'.
VERBOSE: Remove-MailboxDatabase : Updating cluster database resource on server "mailbox-server".
VERBOSE: Remove-MailboxDatabase : Ending processing.

Now the restored database has been both dismounted and removed from Exchange. All that’s left is to go into the file system and delete the files themselves.

To finish cleaning up, we just need to remove the Recovery Storage Group. With the database dismounted and removed, we would be able to do this from the Exchange Console now, but since we already have a shell window open, we’ll just do it from there.

Remove-StorageGroup -Identity "mailbox-server\recovery storage group" -verbose

VERBOSE: Remove-StorageGroup : Beginning processing.
VERBOSE: Remove-StorageGroup : Administrator Active Directory session settings are:  View Entire Forest: 'False',
Default Scope: 'mydomain.pvt', Configuration Domain Controller: 'mydc.mydomain.pvt',
VERBOSE: Remove-StorageGroup : Searching objects "mailbox-server\recovery storage group" of type "StorageGroup" under the root "$null".
VERBOSE: Remove-StorageGroup : Previous operation run on domain controller 'mydc.mydomain.pvt'.

Confirm
Are you sure you want to perform this action?
Removing Storage Group "mailbox-server\recovery storage group".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
VERBOSE: Remove-StorageGroup : Deleting "mailbox-server\Recovery Storage Group" of type "StorageGroup".
VERBOSE: Remove-StorageGroup : Previous operation run on domain controller 'mydc.mydomain.pvt'.
WARNING: The specified storage group has been removed. You must remove the log file located in J:\MyStorageGroup\RSG20091202084953 from your computer manually if it exists. Specified storage group: mailbox-server\recovery storage group.
VERBOSE: Remove-StorageGroup : Ending processing.

That’s all there is. Just have to delete the RSG20091202084953 folders under the MyStorageGroup folders on the H: and J: drives to remove the restored database and transaction logs. Then on to the next restore!

Tuesday, December 1, 2009

Exchange TechCenters

Exchange 2010 TechCenter - http://technet.microsoft.com/en-us/exchange/2010/default.aspx
Exchange 2007 TechCenter - http://technet.microsoft.com/en-us/exchange/bb330841.aspx
Exchange 2003 TechCenter - http://technet.microsoft.com/en-us/exchange/bb288525.aspx

Free Windows PowerShell ebook

Sapien (makers of the PrimalScript script editor) has released their Windows PowerShell v.1 TFM eBook as a FREE download to the public. This is the one book I constantly have open on my desk, and it contains loads of valuable information about PowerShell's core workings and cmdlets. Download the eBook today at http://www.primaltools.com/downloads/communitytools/. Just look for the entry entitled "Powershell TFM V1 eBook".

No Exchange 2010 in 2010

Found out today that we have no plans to implement Exchange 2010 next year. Bummer.

List Calendar Delegates for One or More Mailboxes

A not-so-uncommon problem, at one time or another in most Exchange organizations, in when a user sends out a meeting request and receives a non-delivery report for a former employee. In most of these cases, this is caused by the former employee being listed as a delegate on another user’s calendar. Tracking down the source of this problem can be time-consuming.

Prior to Exchange 2007, this type of problem was difficult to track down, especially if the meeting request had been sent to a large group of people, because you would have to open each user’s mailbox, choose Options from the Tools menu, and then check the Delegates tab. With Exchange 2007, you can just use a powershell command to retrieve the delegates list for one or more mailboxes.

To view the delegates list for a single mailbox, use this command:

Get-MailboxCalendarSettings -Identity <mailbox> | format-list identity,resourcedelegates

To view the delegates list for all mailboxes in a distribution list, use this command:

Get-DistributionGroupMember <distribution group name> | Get-MailboxCalendarSettings | fl identity,resourcedelegates

Since most users do not have delegates, it might be useful to filter out those users with empty delegates lists, leaving only those with delegates, so let’s add a filter to the previous command:

Get-DistributionGroupMember <distribution group name> | Get-MailboxCalendarSettings | where {$_.resourcedelegates -notlike “”} | fl identity,resourcedelegates

To view the delegates list for all mailboxes in a particular database, use this command:

Get-Mailbox -Database <server\database> | Get-MailboxCalendarsettings | where {$_.resourcedelegates -notlike “”} | fl identity,resourcedelegates

To view the delegates list for all mailboxes on a particular server, use this command:

Get-Mailbox -Server <server name> -ResultSize unlimited | Get-MailboxCalendarsettings | where {$_.resourcedelegates -notlike “”} | fl identity,resourcedelegates

Finally, to view the delegates for all mailboxes in the organization, use this command:

Get-Mailbox -ResultSize unlimited | Get-MailboxCalendarsettings | where {$_.resourcedelegates -notlike “”} | fl identity,resourcedelegates

Depending on the size of your organization, these commands may take a bit of time to run.