Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 无法启动CIMSession_Windows_Powershell_Scripting_Cim - Fatal编程技术网

Windows 无法启动CIMSession

Windows 无法启动CIMSession,windows,powershell,scripting,cim,Windows,Powershell,Scripting,Cim,我一直为这个错误伤脑筋。当我尝试启动一个新的CIMSession时,它说找不到计算机。我已经证实了两台计算机都在同一个网络上,并且它们都可以相互通信。我可以相互ping两台电脑,也可以访问共享文件夹。我可以使用IP和NetBIOS名称进行ping。我已将这两台电脑都添加到组策略上的受信任主机,并允许它在防火墙上运行。我错过了什么或者我做错了什么 PS C:\Windows\system32> $session=New-CimSession -ComputerName DESKTOP-FJM

我一直为这个错误伤脑筋。当我尝试启动一个新的CIMSession时,它说找不到计算机。我已经证实了两台计算机都在同一个网络上,并且它们都可以相互通信。我可以相互ping两台电脑,也可以访问共享文件夹。我可以使用IP和NetBIOS名称进行ping。我已将这两台电脑都添加到组策略上的受信任主机,并允许它在防火墙上运行。我错过了什么或者我做错了什么

PS C:\Windows\system32> $session=New-CimSession -ComputerName DESKTOP-FJMTUOQ
New-CimSession : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a 
firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to 
remote computers within the same local subnet.
At line:1 char:10
+ $session=New-CimSession -ComputerName DESKTOP-FJMTUOQ
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ConnectionError: (:) [New-CimSession], CimException
    + FullyQualifiedErrorId : HRESULT 0x80338126,Microsoft.Management.Infrastructure.CimCmdlets.NewCimSessionCommand
    + PSComputerName        : DESKTOP-FJMTUOQ

编辑

运行
testnetconnection-ComputerName DESKTOP-fjmtooq-commontcport WINRM
时,我得到以下结果

PS C:\Windows\system32> Test-NetConnection -ComputerName DESKTOP-FJMTUOQ -CommonTCPPort WINRM
WARNING: TCP connect to DESKTOP-FJMTUOQ:5985 failed


ComputerName           : DESKTOP-FJMTUOQ
RemoteAddress          : 10.0.2.15
RemotePort             : 5985
InterfaceAlias         : Ethernet
SourceAddress          : 10.0.2.254
PingSucceeded          : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded       : False
编辑-相同测试但向后(从DESKTOP-FJMTUOQ到WIN-R9HLL0ILD3)


你能用PoweShell远程连接吗?CIM cmdlet使用相同的底层协议(WS-Man)进行通信,与使用DCOM的旧WMI cmdlet不同。在任何一种情况下,ping或浏览共享都不能保证连接。从本地计算机上运行
测试网络连接-ComputerName DESKTOP-fjmtooq-commontcport WINRM
,并将结果粘贴到问题正文中。@AndrewRyanDavis我已将结果放在正文中。这可能是网络ACL问题。您无法在WinRM使用的端口上连接。您是否能够确认网络防火墙已打开且未阻止此流量?是。我甚至尝试关闭两个防火墙(它们不是生产机器),但仍然得到相同的错误。奇怪的是,当我向后做的时候(从DESTOP-fjmtooq到WIN-R9HLL0ILD37),你可以从我刚才添加到问题主体上的结果中看到,测试是通过的
PS C:\Users\freyes.FRANK> Test-NetConnection -ComputerName WIN-R9HLL0ILD37 -CommonTCPPort WINRM                                                                                                                                                                                                                                                                         ComputerName     : WIN-R9HLL0ILD37
RemoteAddress    : 10.0.2.254
RemotePort       : 5985
InterfaceAlias   : Ethernet
SourceAddress    : 10.0.2.15
TcpTestSucceeded : True