Remove-CsOnlineTelephoneNumber

Use the Remove-CsOnlineTelephoneNumber cmdlet to remove one or more unassigned telephone numbers from your tenant.

Syntax

Remove-CsOnlineTelephoneNumber
      -TelephoneNumber <String[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

This cmdlet removes one or more unassigned telephone numbers from your tenant. If at least one of the telephone numbers is assigned to a user or resource account, the cmdlet will fail and will not remove any of the specified telephone numbers.

Examples

-------------------------- Example 1 --------------------------

Remove-CsOnlineTelephoneNumber -TelephoneNumber 14258884567

NumberIdsDeleted NumberIdsDeleteFailed NumberIdsNotOwnedByTenant NumberIdsManagedByServiceDesk
---------------- --------------------- ------------------------- -----------------------------
{14258884567}    {}                    {}                        {}

This example removes the specified telephone number from the tenant.

-------------------------- Example 2 --------------------------

[string[]]$tns="+14255551234","+14255551233"
Remove-CsOnlineTelephoneNumber -TelephoneNumber $tns

NumberIdsDeleted NumberIdsDeleteFailed NumberIdsNotOwnedByTenant NumberIdsManagedByServiceDesk
---------------- --------------------- ------------------------- -----------------------------
{14255551234,     {}                    {}                        {}
 14255551233}

This example removes the specified list of telephone numbers from the tenant.

Parameters

-Confirm

The Confirm switch causes the command to pause processing and requires confirmation to proceed.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

The Force switch specifies whether to suppress warning and confirmation messages. It can be useful in scripting to suppress interactive prompts. If the Force switch isn't provided in the command, you're prompted for administrative input if required.

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

-TelephoneNumber

Specifies the telephone number(s) to remove. The format can be with or without the prefixed +, but needs to include country code etc.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

The WhatIf switch causes the command to simulate its results. By using this switch, you can view what changes would occur without having to commit those changes.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Input types

None

Outputs

Output types

None

Notes

If one or more of the telephone numbers are assigned to a user or a service, the cmdlet will display an error message and none of the telephone numbers specified will be removed from your tenant.