Remove-ExchangeAddressList
Exchange: Deletes an Address List
#Requires -Version 5.1
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true)]
[string]$Identity,
[switch]$Recursive
)
Process {
try {
$params = @{
'Identity' = $Identity
'Confirm' = $false
'ErrorAction' = 'Stop'
}
if ($Recursive.IsPresent) { $params.Add('Recursive', $true) }
Remove-AddressList @params
$result = [PSCustomObject]@{
Identity = $Identity
Action = "AddressListRemoved"
Status = "Success"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the Identity of the address list to remove.
Off
If set, removes the specified address list and all its child address lists.