Share via


Remove-ServiceFabricService

Removes an existing Service Fabric service.

Syntax

Default (Default)

Remove-ServiceFabricService
    [-ServiceName] <Uri>
    [-Force]
    [-ForceRemove]
    [-TimeoutSec <Int32>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Remove-ServiceFabricService cmdlet removes an existing Service Fabric service. A service must be running before you can remove it.

Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.

Examples

Example 1: Remove a service fabric

PS C:\> Remove-ServiceFabricService -ServiceName fabric:/myapp/persistenttodolist/svc1 -Force

This command removes the specified Service Fabric service. Because the command includes the Force parameter, the cmdlet does not prompt you for confirmation.

Example 2: ForceRemove a service fabric service with Confirmation

PS C:\> Remove-ServiceFabricService -ServiceName fabric:/myapp/persistenttodolist/svc1 -Confirm -ForceRemove

This command force removes the specified Service Fabric service. Because the command includes the Confirm parameter, the cmdlet will prompt you to confirm if it is the intended service name you want to execute the operation on. After the confirmation, the service is removed ungracefully because of the ForceRemove parameter.

Example 3: ForceRemove a service fabric service with Timeout

PS C:\> Remove-ServiceFabricService -ServiceName fabric:/myapp/persistenttodolist/svc1 -TimeoutSec 10 -ForceRemove

This command force remove the specified Service Fabric service. Because the command includes the Timeout parameter, the operation will timeout if the operation cannot complete in specified time.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
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

Forces the command to run without asking for user confirmation. Powershell won't ask for the user confirmation to execute the command.

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

-ForceRemove

Indicates that this command forces removal of the Service Fabric service. This should be used only if the removal of the service is timing out. For example: If Remove-ServiceFabricService is timing out and the replicas of the service are still present then, this means that the service is stuck in ChangeRole/Close and the shutdown sequence cannot complete. By using ForceRemove, we skip the service shutdown sequence and the service is removed ungracefully. For stateful service, its persistent state would not be cleaned. To check if replicas are present, use Get-ServiceFabricReplica.

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

-ServiceName

Specifies the Uniform Resource Identifier (URI) of a Service Fabric service.

Parameter properties

Type:Uri
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TimeoutSec

Specifies the time-out period, in seconds, for the operation.

Parameter properties

Type:Int32
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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run and no permanent changes are made.

Parameter properties

Type:SwitchParameter
Default value:False
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

System.Uri

Outputs

System.Object