When users are deleted from the Active Directory, the Exchange mailboxes are not automatically deleted but disconnected. This means that the mailbox still exists in the database, but is no longer assigned to a user.
If the user associated with a mailbox has only recently been deleted, the disconnected mailbox will not be displayed directly in the list of disconnected mailboxes in the Exchange administration console. If you do not want to wait until Exchange automatically searches for disconnected mailboxes, you can initiate this yourself using the following command:
Get-MailboxDatabase | Clean-MailboxDatabase
The disconnected mailboxes are then displayed in the Exchange administration console, where they can be reconnected but not deleted. The mailbox can only be deleted via the GUID of the mailbox. This can be displayed as follows:
get-mailboxdatabase | get-mailboxstatistics | Where{ $_.DisconnectDate -ne $null } |fl displayName,Identity,disconnectdate
If you now want to delete the mailbox, copy the value from "Identity" and append it to the Remove-MailboxDatabase command:
Remove-mailbox -database "Name of the mailbox database" -storemailboxidentity "Value of the identity"
Example:
Remove-mailbox -database "MailBoxDatabase01" -storemailboxidentity 853ad730-7111-4569-ad54-ef002046e97f
Note:
There was a change here with Service Pack 1, more details can be found here: https://www.frankysweb.de/?p=209
Hallo,
wie kann ich denn beide Befehle zusammenführen um alle getrennten Postfächer zu löschen?
Gruß
Klaus
Hi Klaus,
so zum Beispiel:
$mailboxes = get-mailboxdatabase | Get-MailboxStatistics | where-object { $_.DisconnectDate –notlike ” } | Select displayname, mailboxguid, database
$mailboxes | ForEach { Remove-StoreMailbox -Database $_.Database -Identity $_.MailboxGuid -MailboxState “Softdeleted” -confirm:$false }
Gruß, Frank
Funktioniert gut. Nun erscheint aber der gelöschte Benutzer nicht wieder bei der Postfacherstellung mit vorhandenem Benutzer.
Hallo Frank.
Die Lösung war bei mir folgendes:
Remove-StoreMailbox -database „MB1-2SRV02D“ -Identity „bbfd42dc-0b14-4ed3-aceb-f369159ddaa1“ -MailboxState SoftDeleted
Vielen Dank und Grüße
Rolf
Hallo Rolf,
welcher Fehler tritt denn auf?
Das Vorgehen bei mehreren Datenbanken ist etwas anders, vieleicht hilft dir das weiter:
führe zunächst den Verwaltungsvorgang „clean-mailboxdatabase“ aus:
Get-MailboxDatabase | Clean-MailboxDatabase
Hier brauchst du noch keine Datenbank angeben, aber beim Löschen des getrennten Postfaches. Um zu herauszufinden in welcher Datenbank das Postfach war, erweitere den Befehl „get-mailboxstatistics“ um die Angabe „database“
get-mailboxdatabase | get-mailboxstatistics | Where{ $_.DisconnectDate -ne $null } |fl displayName,Identity,disconnectdate,database
Jetzt solltest du alle getrennten Postfächer aller Datenbanken auf dem Server angezeigt bekommen inklusive der Datenbank in der das Postfach liegt, dann passe diesen Befehl mit den Werten an, die dir get-mailboxstatistics anzeigt:
Remove-mailbox -database “Wert der bei Database steht” -storemailboxidentity “Wert der bei Identity steht”
Wenn das nicht klappt, dann poste doch bitte die Fehlermeldung der Shell,
Gruss, Frank
Hallo Frank.
Ich habe Probleme mit dem löschen und habe mehr als eine Mailbox Datenbank.
Kannst Du weiter helfen?
Grüße
Rolf
Vielen Dank,
genau nach diesem habe ich gesucht.
Hallo,
habe den Befehl oben ausgeführt, es wird mir die Storemailboxidentity angezeigt und ich verwende diese, daraufhin kommt folgende Fehlermeldung:
„Das angegebene Postfach „283e71cc-0068-4830-bfb5-28433fc646b2“ ist nicht in der Datenbank „medium“ vorhanden“
Aber wenn ich in der Verwaltungskonsole/getrenntes Postfach -> nachschaue ist dieses Postfach vorhanden?
Was ist das für ein Problem???
Hallo, gibt es mehr als eine Mailbox Datenbank? Gruss, Frank