Skip to content

Remove-ExchangeResource

Exchange: Deletes a Resource Mailbox

#Requires -Version 5.1

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true)]
    [string]$Identity,

    [switch]$Permanent
)

Process {
    try {
        $params = @{
            'Identity'    = $Identity
            'Permanent'   = $Permanent.IsPresent
            'Confirm'     = $false
            'ErrorAction' = 'Stop'
        }

        Remove-Mailbox @params

        $result = [PSCustomObject]@{
            Identity  = $Identity
            Action    = "ResourceRemoved"
            Status    = "Success"
            Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

Specifies the Identity of the resource mailbox to remove.

Off

If set, permanently deletes the mailbox, bypassing the recycle bin/soft-delete state.

An interactive directory of PowerShell scripts.