2016-08-25 10 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 
} 
関連する問題