Skip to content

Remove-Resource

Exchange Online: Removes a resource mailbox

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$MailboxId,
    [switch]$Permanent
)

Process {
    try {
        $null = Remove-Mailbox -Identity $MailboxId -Permanent:$Permanent -Force -Confirm:$false -ErrorAction Stop

        [PSCustomObject]@{
            Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
            Message   = "Resource $($MailboxId) removed"
        }
    }
    catch { throw }
}

Alias, Display name, Distinguished name, SamAccountName, Guid or user principal name of the resource to remove

Off

Permanently delete the resource from the database

An interactive directory of PowerShell scripts.