2016-08-25 3 views
0

내가 원격 서버에 연결이 PowerShell 명령연결 원격 서버 및 실행 스크립트

Invoke-Command -ComputerName \\srvwebui3 -ScriptBlock { 
    Get-Process | Where-Object { 
     $_.Path -like "\\abd\net$\abd\versions\Bin\HttpServer.exe" 
    } | Stop-Process 
} 

을 사용하여에 프로세스를 중지하기 위해 노력하고있어하지만 난 그것을 실행 한 후이 오류 메시지가 있어요 :

Invoke-Command : One or more computer names is not valid. If you are trying to 
pass a Uri, use the -ConnectionUri parameter or pass Uri objects instead of 
strings. 
At C:\powerShell\stop-process.ps1:4 char:15 
+ Invoke-Command <<<< -ComputerName \\srvwebui3 -ScriptBlock { Get-Process | Where-Object {$_.Path -like "\\gaia\netlims$\Autolims\MainRls\Bin\HttpServer.exe"} | Stop-Process } 
    + CategoryInfo   : InvalidArgument: (System.String[]:String[]) [Invoke-Command], ArgumentException 
    + FullyQualifiedErrorId : PSSessionInvalidComputerName,Microsoft.PowerShell.Commands.InvokeCommandCommand
을 여기
+1

컴퓨터 이름에서 선도적 인 백 슬래시를 제거합니다. –

답변

0

일 PowerShell은 코드 :

Invoke-Command -ComputerName <computerName> -ScriptBlock { 
    Get-Process | Where-Object { 
      $_.Path -like \\bbb\abab$\bs\MainRls\Bin\HttpServer.exe" 
    } | 
    Stop-Process -Force 
}