Powershell 获取远程计算机上已安装程序的列表
我创建了下面的过程来获取远程计算机上已安装程序的列表。我在我的计算机上测试了它,它工作得很好,但是当我尝试在我的网络中使用时,我得到了下面的错误 我以网络管理员的身份运行它 代码:Powershell 获取远程计算机上已安装程序的列表,powershell,Powershell,我创建了下面的过程来获取远程计算机上已安装程序的列表。我在我的计算机上测试了它,它工作得很好,但是当我尝试在我的网络中使用时,我得到了下面的错误 我以网络管理员的身份运行它 代码: Invoke-Command -ComputerName brpgd008 { Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, Display
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
错误:
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
错误:[brpgd008]连接到远程服务器失败,出现以下错误
消息:WinRM无法处理该请求。运行时发生以下错误
使用Kerberos身份验证:指定的登录会话不存在。可能
已经被终止。
可能的原因有:
-指定的用户名或密码无效。
-当未指定身份验证方法和用户名时,将使用Kerberos。
-Kerberos接受域用户名,但不接受本地用户名。
-远程计算机名称和端口的服务主体名称(SPN)无效
不存在。
-客户端和远程计算机位于不同的域中,不存在信任
在两个域之间。
检查上述问题后,请尝试以下操作:
-检查事件查看器中与身份验证相关的事件。
-改变认证方式;将目标计算机添加到WinRM
TrustedHosts配置设置或使用HTTPS传输。
请注意,TrustedHosts列表中的计算机可能未经过身份验证。
-有关WinRM配置的详细信息,请运行以下命令:
winrm帮助配置。有关更多信息,请参阅关于远程故障排除
帮助主题。
+CategoryInfo:OpenError:(:)[],PSRemotingTransportException
+FullyQualifiedErrorId:PSSessionStateBreaked
正如许多其他人指出的,您的问题是无法通过WinRM创建PSSession。WinRM上的PSRemoting是
Invoke命令所使用的。解决此问题的最简单方法是在远程主机上运行启用PSRemoting
。有许多指南可以帮助您在整个环境中使用诸如组策略之类的内容来配置此功能
也就是说,您可以使用与WinRM不同的方法来轮询这些注册表值。例如,您可以使用[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey()
(我相信它使用的是远程注册表
服务):
请注意,在x64系统上,您需要签入32位应用程序的WOW6432Node
。您是否真的费心阅读错误消息?您需要先建立与远程计算机的连接。获取帮助WinRM错误消息非常清楚。您应该按照@WillWebb的建议查看WinRM,还应该查看Powershell远程处理。@ChrisCaviness-我在这里没有看到任何haxxoring;他在寻找安装的程序,而不是正在运行的程序。这是管理员需要知道的合法信息。他是否是一名称职的管理者是一个完全不同的问题,他显然无法阅读和理解他所问的错误,因此需要进行评估——但我看不到任何指控哈克索林的依据。