Unable to delete Database

I am unable to delete an Exchange 2010 SP3 Database.  It says
This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, or arbitration mailboxes.
 I have ran the following powershell commands:

Get-Mailbox -database archive
Get-Mailbox -archive -database archive
Get-Mailbox -publicfolder -database archive
Get-Mailbox -arbitration -database archive
Get-Mailbox -resultsize unlimited | where {$_.ArchiveDatabase -eq "archive"}

Nothing shows up on that database.  I have waited over 24 hours to make sure it wasn't a replication thing and there are no other copies of the database attached.  I have dismounted that database as well to try and remove it but still receive the same error.  I know you can delete it through ADSIEDIT but I would like to find a solution without going into there.

Any help would be greatly appreciated.  Thanks!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
It is possible that there are still "soft deleted" mailboxes on this database? Use the following command to check for soft deleted mailboxes.

Get-MailboxStatistics –Database “database1” | 
? {$_.DisconnectReason –eq “Softdeleted”} |
ForEach {Remove-StoreMailbox –Database $_.database –identity $_.mailboxguid –MailboxState Softdeleted

Open in new window

Sedgwick_CountyAuthor Commented:
Are you able to script that where I do not have to keep hitting Y to delete them?  I have tried -confirm:$false but doesn't work.
Will SzymkowskiSenior Solution ArchitectCommented:
At the end of the script try -confirm $false. Sorry I also for got a closing } .

Try that.

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Sedgwick_CountyAuthor Commented:
I have all but 5 left...but I am having issues removing them.  Through the whole time using that script I had to keep re-running it and at first it says this:

Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
    + CategoryInfo          : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [],
    + FullyQualifiedErrorId : RemotePipelineExecutionFailed

But it would let me delete mailboxes.  Now, I show there are 5 left and I run the script and it say there are no mailboxes to remove.  But I run the first two pipe commands and I show 5 mailboxes left.  I go to delete the mailbox database and I get the error that items are still there.
Will SzymkowskiSenior Solution ArchitectCommented:
I have reconstructed the script. Please try the following below...
$database = "DatabaseName"
$Find = Get-MailboxStatistics –Database $database | ? {$_.DisconnectReason –eq “Softdeleted”}

ForEach ($mb in $Find) {

    Remove-StoreMailbox –Database $mb.database –identity $mb.MailboxGuid –MailboxState Softdeleted


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sedgwick_CountyAuthor Commented:
I ran the script and it removed the rest but now it says this when I run the script:

Cannot bind argument to parameter 'Database' because it is null.

So I go to remove the database and it still throws up the error saying something is in there still.
Sedgwick_CountyAuthor Commented:
Thank you for the help.  We ran the script and it removed all the left behind info but we ended up just using ADSIEDIT since we couldn't completely clean it up.  Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.