| external help file | Microsoft.PowerShell.Commands.Management.dll-Help.xml |
|---|---|
| Locale | en-US |
| Module Name | Microsoft.PowerShell.Management |
| ms.date | 02/04/2026 |
| online version | https://learn.microsoft.com/powershell/module/microsoft.powershell.management/remove-service?view=powershell-7.4&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Remove-Service |
Removes a Windows service.
Remove-Service [-Name] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-Service [-InputObject <ServiceController>] [-WhatIf] [-Confirm] [<CommonParameters>]
The Remove-Service cmdlet removes a Windows service in the registry and in the service database.
The Remove-Service cmdlet was introduced in PowerShell 6.0.
This removes a service named TestService.
Remove-Service -Name "TestService"This example removes a service named TestService. The command uses Get-Service to get an object
that represents the TestService service using the display name. The pipeline operator (|) pipes
the object to Remove-Service, which removes the service.
Get-Service -DisplayName "Test Service" | Remove-ServiceSpecifies ServiceController objects that represent the services to remove. Enter a variable that contains the objects, or type a command or expression that gets the objects.
The InputObject parameter doesn't enumerate collections. If a collection is passed, an error is thrown. When working with collections, pipe the input to enumerate the values.
Type: System.ServiceProcess.ServiceController
Parameter Sets: InputObject
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseSpecifies the service names of the services to remove. Wildcard characters are permitted.
Type: System.String
Parameter Sets: Name
Aliases: ServiceName, SN
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: TruePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can pipe a service object to this cmdlet.
You can pipe a string that contains the name of a service to this cmdlet.
This cmdlet returns no output.
This cmdlet is only available on Windows platforms.
To run this cmdlet, start PowerShell by using the Run as administrator option.
Like the other *-Service cmdlets, this command doesn't have a ComputerName parameter. To use
this command on a remote computer, use the Invoke-Command to target a remote system.