다음을 통해 공유


Remove-Service

Removes a Windows service.

구문

Name (기본값)

Remove-Service
    [-Name] <String>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObject

Remove-Service
    [-InputObject <ServiceController>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

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.

예제

Example 1: Remove a service

This removes a service named TestService.

Remove-Service -Name "TestService"

Example 2: Remove a service using the display name

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-Service

매개 변수

-Confirm

Prompts you for confirmation before running the cmdlet.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:cf

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-InputObject

Specifies 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.

매개 변수 속성

형식:ServiceController
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

InputObject
Position:Named
필수:False
파이프라인의 값:True
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Name

Specifies the service names of the services to remove. Wildcard characters are permitted.

매개 변수 속성

형식:String
Default value:None
와일드카드 지원:True
DontShow:False
별칭:ServiceName, SN

매개 변수 집합

Name
Position:0
필수:True
파이프라인의 값:True
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:wi

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값: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.

입력

ServiceController

You can pipe a service object to this cmdlet.

String

You can pipe a string that contains the name of a service to this cmdlet.

출력

None

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.