2017-11-16 67 views
0

最近、リモートコンピュータ上の重要なプロセスを監視できるように、PowerShellを使用してスクリプトをセットアップしようとしていました。Get-Processがリモートマシンに接続できませんでした

Get-Process -ComputerName myremotepc myprocess 

これは私に次のエラーを与えていました。

Get-Process : Couldn't connect to remote machine. 
At line:1 char:1 
+ Get-Process -ComputerName myremotepc myprocess 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo   : NotSpecified: (:) [Get-Process],  InvalidOperationException 
+ FullyQualifiedErrorId :  System.InvalidOperationException,Microsoft.PowerShell.Commands.GetProcessCommand 

正しいサービスが有効になっていることを確認した後、私はまだ接続できません。

答えて

-2

私は次のリンクを見つけました。

https://social.technet.microsoft.com/Forums/projectserver/en-US/f58c4ca9-0708-401a-8d66-86195006174d/simple-remote-command-getprocess-how-to-get-the-two-machines-talking-to-each-other?forum=winserverpowershell

そのページにあるユーザーがリモート処理を接続したいPCのためのPowerShellでオンにすることが可能にすることを示唆しました。

# Enable Remoting 
Enable-PSRemoting 

これをpowershellで実行した後、昇格したプロンプトでリモートPCに問い合わせることができます。

Handles NPM(K) PM(K)  WS(K) VM(M) CPU(s)  Id ProcessName 
------- ------ -----  ----- ----- ------  -- ----------- 
811  38  27696  28568 233    3196 explorer 
1

それはPSRemotingを有効にする必要がないことを明示的に述べて注意してください。その違いは、プロンプトの上昇またはファイアウォールの例外の可能性が高いことでした。

PS C:\> Get-Help Get-Process -Parameter 'ComputerName' 

-ComputerName <String[]> 
    Specifies the computers for which this cmdlet gets active processes. The default is the local computer. 

    Type the NetBIOS name, an IP address, or a fully qualified domain name (FQDN) of one or more computers. To specify the local computer, type the computer name, a dot (.), or localhost. 

    This parameter does not rely on Windows PowerShell remoting. You can use the ComputerName parameter of this cmdlet even if your computer is not configured to run remote commands. 

    Required?     false 
    Position?     named 
    Default value    None 
    Accept pipeline input?  True (ByPropertyName) 
    Accept wildcard characters? false 
+1

またはタイプミス、またはネットワークの問題.... – Matt

+0

PS Remotingが必要ないことを確認できます。私はPS Remotingが有効になっていない環境で働き、Get-Processを日常的に使用しています。 – EBGreen

+0

私はこれをスクリプトから実行しています。私は、リモーティングがオンになっていない別のコンピュータをテストしたところ、失敗しました。私は何か間違っている可能性があります。 – Prescient

関連する問題