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!