2017-04-18 2 views
0

以下の手順でリモートマシンにインストールされているプログラムのリストを取得しました。私は自分のコンピュータでそれをテストしたところ正常に動作しましたが、私のネットワークで使用しようとすると、私は以下のエラーを受けています。リモートマシンにインストールされているプログラムのリストを取得

私はネットワーク管理者として実行しています。

コード:

Invoke-Command -ComputerName brpgd008 { 
    Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | 
    Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | 
    Format-Table –AutoSize > \\brspd010\c$\users\machael1\desktop\product1.txt 
} 

は、エラー:多くの人が指摘したように

 
error:[brpgd008] Connecting to remote server failed with the following error 
message : WinRM cannot process the request. The following error occured while 
using Kerberos authentication : A specified logon session does not exist. It may 
already have been terminated. 
Possible causes are: 
    -The user name or password specified are invalid. 
    -Kerberos is used when no authentication method and no user name are specified. 
    -Kerberos accepts domain user names, but not local user names. 
    -The Service Principal Name (SPN) for the remote computer name and port does 
    not exist. 
    -The client and remote computers are in different domains and there is no trust 
    between the two domains. 
After checking for the above issues, try the following: 
    -Check the Event Viewer for events related to authentication. 
    -Change the authentication method; add the destination computer to the WinRM 
    TrustedHosts configuration setting or use HTTPS transport. 
Note that computers in the TrustedHosts list might not be authenticated. 
    -For more information about WinRM configuration, run the following command: 
    winrm help config. For more information, see the about_Remote_Troubleshooting 
    Help topic. 
    + CategoryInfo   : OpenError: (:) [], PSRemotingTransportException 
    + FullyQualifiedErrorId : PSSessionStateBroken 
+2

あなたは実際にエラーメッセージを読んでいましたか? –

+2

リモートマシンへの接続を最初に確立する必要があります。 Get-Help WinRM –

+2

エラーメッセージは非常に明確です。 @WillWebbの助言を受けてWinRMを調べ、Powershell Remotingを調べる必要があります。 –

答えて

0

、あなたの問題は、WinRMのオーバーのPSSessionを作成することができないということです。 WinRM上のPSRemotingは、Invoke-Commandによって使用されているものです。これを解決する最も簡単な方法は、リモートホスト上でEnable-PSRemotingを実行することです。グループポリシーのようなものを使用して、環境全体でこれを構成するための多くのガイドがあります。

このように、WinRM以外の方法でこれらのレジストリ値をポーリングすることができます。 、注意点として

$ComputerName = "brpgd008" 
$RegLocation = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" 
$Values = "DisplayName", "DisplayVersion", "Publisher", "InstallDate" 
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName) 

$RegKey= $Reg.OpenSubKey($RegLocation) 
$SubKeys = $RegKey.GetSubKeyNames() 

foreach ($SubKey in $SubKeys) { 
    $Output = New-Object -TypeName PSObject 
    $LeafKey = $Reg.OpenSubKey("$RegLocation$SubKey") 
    Foreach ($Value in $Values) { 
     Add-Member -InputObject $Output -MemberType NoteProperty -Name $value -Value ($LeafKey.GetValue($Value)) 
    } 
    $Output 
} 

を使用すると、32ビットアプリケーション用のWOW6432Nodeにチェックする必要がありますx64システム上でのことを覚えている:たとえば、[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey()(私は信じてRemote Registryサービスを使用しています)を使用することができます。

関連する問題