Skip to content

Remove-SharedMailbox

SYNOPSIS

Remove a shared mailbox from Exchange or the Onderwijs Gent Office 365 environment.

SYNTAX

Remove-SharedMailbox [-Identity] <String[]> -TaskNr <Int32> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The `Remove-SharedMailbox` function removes a shared mailbox. It supports both on-premises and cloud environments, including the Onderwijs Gent Office 365 tenant. The function validates the mailbox type, logs the removal action, and handles associated groups and contacts.

EXAMPLES

EXAMPLE 1

Remove-SharedMailbox -Identity "[email protected]" -TaskNr 12345

Removes the shared mailbox `sharedmailbox@example.com` and logs the action with task number 12345.

EXAMPLE 2

Remove-SharedMailbox -Identity "[email protected]" -TaskNr 67890 -Force

Removes the shared mailbox `sharedmailbox@onderwijs.gent.be` in the Onderwijs Gent Office 365 environment without confirmation prompts.

PARAMETERS

-Identity

The identity of the shared mailbox to be removed. Can be a UserPrincipalName or primary SMTP address.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-TaskNr

The task number associated with the removal of the shared mailbox, used for logging purposes.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-Force

A switch to bypass confirmation prompts during the removal process.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES