2015-01-01 2 views
0
Get-Service | Stop-Process -Name WSearch -WhatIf 

스톱 프로세스 : 입력 개체는 명령에 대한 매개 변수에 바인딩되지 않을 수 있습니다 명령을 입력하고 해당 속성을 파이프 라인 입력을하거나 하지 않기 때문에 파이프 라인 입력을 매개 변수 일치하지 않습니다. 1 개 문자 : 줄에서 15 + 가져 오기 서비스를 | 중지 - 프로세스 - 이름 WSearch -WhatIf + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument : (fdPHost : PSObject), ParameterBindingException [-프로세스를 중지] + FullyQualifiedErrorId : InputObjectNotBound는 Microsoft.PowerShell.Commands.StopProcessCommand 둘 다 같은 속성 이름을 공유하는 나의 이해에서 지금PowerShell을 얻을 서비스 중지 프로세스로 파이프

은 "이름"그래서 나는 할 수 있어야한다 이름을 통해 파이프로 연결 하시겠습니까?

PS C:\> Get-Service | gm 
    TypeName: System.ServiceProcess.ServiceController 
Name      MemberType Definition 
----      ---------- ---------- 
Name      AliasProperty Name = ServiceName 

get-help stop-process 

    -Name <String[]> 
     Specifies the process names of the processes to be stopped. You can type multiple process names (separated by commas) or use wildcard characters. 

     Required?     true 
     Position?     named 
     Default value     
     Accept pipeline input?  true (ByPropertyName) 
     Accept wildcard characters? true 

여기 내가 잘못된 것을하고 있습니까?

답변

3
Get-Service -Name wsearch | Stop-Service 

. 먼저 필터링하고 파이프 라인을 통해 결과를 전달하십시오.

+2

또는 당신은'중지 서비스 - 이름을 wsearch'을 할 수 있습니다. –

관련 문제