Remove-ServiceFabricService
Removes an existing Service Fabric service.
Syntax
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.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Force
Forces the command to run without asking for user confirmation. Powershell won't ask for the user confirmation to execute the command.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ServiceName
Specifies the Uniform Resource Identifier (URI) of a Service Fabric service.
Type: | Uri |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TimeoutSec
Specifies the time-out period, in seconds, for the operation.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run and no permanent changes are made.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
System.Uri
Outputs
System.Object