Remove-CsOnlineTelephoneNumber
Use the Remove-CsOnlineTelephoneNumber
cmdlet to remove one or more unassigned telephone numbers from your tenant.
Syntax
Default (Default)
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.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
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.