117k views
2 votes
Powershell: steps to deleting a user so that you can create a new mailbox by the same name?

a) Remove-Mailbox -Force
b) Disable-User -RecreateMailbox
c) New-Mailbox -Alias
d) Rename-User -CreateMailbox

User Arlin
by
8.7k points

1 Answer

5 votes

Final answer:

To delete a user and create a new mailbox by the same name in PowerShell, use the Remove-Mailbox cmdlet, then wait for the system to process the removal before using the New-Mailbox cmdlet with the desired alias.

Step-by-step explanation:

To delete a user in PowerShell so that you can create a new mailbox using the same name, you would first use the Remove-Mailbox cmdlet. This action permanently deletes the mailbox and the user account that is associated with the mailbox. Following the deletion, you may have to wait for Active Directory replication to complete and for the system to fully recognize the removal before creating a mailbox with the same username or alias.

If your intentions are to simply disconnect the mailbox and not delete the user account, you would use the Disable-Mailbox cmdlet instead, which would preserve the user account but remove the mailbox, making the username available for a new mailbox creation.

Command b) Disable-User -RecreateMailbox is incorrect because 'Disable-User' is not a valid cmdlet for managing mailboxes, and c) New-Mailbox -Alias is a cmdlet used for creating a new mailbox rather than removing one.

Similarly, d) Rename-User -CreateMailbox does not correspond to any actual PowerShell cmdlet for mailbox management. When ready to create a new mailbox, the New-Mailbox cmdlet would be used along with the desired alias.

User Sangjoon Moon
by
8.4k points