本文提供了一个解决方案,用于解决以下问题:更改 dynamicportrange 设置时 Hyper-V VMM 服务失败并记录事件 ID 14050。
原始 KB 数: 2761899
现象
假设你有一台运行安装了 Hyper-V 的 Windows Server 2012 的计算机。 如果尝试使用 System Center Virtual Machine Manager 2012 Service Pack 1(SP1)或使用 Hyper-V 管理器远程管理 Hyper-V 主机,则尝试会失败。 此外,事件可能会记录在事件日志中,如下所示:
日志名称:Microsoft-Windows-Hyper-V-VMMS-Admin
源:Microsoft-Windows-Hyper-V-VMMS
日期: <日期><时间>
事件 ID:14050
级别:错误
说明:无法注册服务主体名称。
事件 Xml: ...
<Parameter0>Hyper-V 副本服务</参数0>
原因
如果 TCP 动态端口范围已退出默认范围,则可能会出现此问题。 Hyper-V 的虚拟管理服务(Vmms.exe)使用 Windows 服务强化,并将自身限制为动态端口范围。
若要确定 TCP 动态端口范围,请在提升的命令提示符处运行以下命令:
C:\>netsh int ipv4 show dynamicportrange tcp Protocol tcp Dynamic Port Range --------------------------------- Start Port : 49152 Number of Ports : 16384
如果 NTDS 端口限制为域控制器上的特定端口,也可能出现此问题。 如果所选 NTDS 端口不在默认范围内,则必须在每个 Hyper-V 主机上的“解析”部分中运行脚本来添加此端口。
有关详细信息,请单击以下文章编号,转到Microsoft知识库中的文章:
224196限制 Active Directory 复制流量和客户端 RPC 流量到特定端口
解决方法
若要解决此问题,请在每个受影响的 Hyper-V 主机上运行以下脚本一次。 此脚本添加了一个自定义端口范围,使Vmms.exe能够通过 9000 到 9999 的其他端口范围进行通信。 可以根据需要修改脚本。
若要配置脚本以添加自定义端口范围,请执行以下步骤:
启动一个文本编辑器(例如记事本)。
复制以下代码,然后将代码粘贴到文本文件中:
'This VBScript adds a port range from 9000 to 9999 for outgoing traffic 'run as cscript addportrange.vbs on the hyper-v host option explicit 'IP protocols const NET_FW_IP_PROTOCOL_TCP = 6 const NET_FW_IP_PROTOCOL_UDP = 17 'Action const NET_FW_ACTION_BLOCK = 0 const NET_FW_ACTION_ALLOW = 1 'Direction const NET_FW_RULE_DIR_IN = 1 const NET_FW_RULE_DIR_OUT = 2 'Create the FwPolicy2 object. Dim fwPolicy2 Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")'Get the Service Restriction object for the local firewall policy. Dim ServiceRestriction Set ServiceRestriction = fwPolicy2.ServiceRestriction 'If the service requires sending/receiving certain type of traffic, then add "allow" WSH rules as follows 'Get the collection of Windows Service Hardening networking rules Dim wshRules Set wshRules = ServiceRestriction.Rules 'Add outbound WSH allow rules Dim NewOutboundRule Set NewOutboundRule = CreateObject("HNetCfg.FWRule") NewOutboundRule.Name = "Allow outbound traffic from service to TCP 9000 to 9999" NewOutboundRule.ApplicationName = "%systemDrive%\WINDOWS\system32\vmms.exe" NewOutboundRule.ServiceName = "vmms" NewOutboundRule.Protocol = NET_FW_IP_PROTOCOL_TCP NewOutboundRule.RemotePorts = "9000-9999" NewOutboundRule.Action = NET_FW_ACTION_ALLOW NewOutboundRule.Direction = NET_FW_RULE_DIR_OUT NewOutboundRule.Enabled = true wshRules.Add NewOutboundRule 'end of script
将文件另存为“Addportrange.vbs”(包括引号)。 这会正确地创建文件,因为它具有 .vbs 扩展名。 文件图标从记事本图标更改为脚本图标。
以 cscript 身份运行脚本。
参考
970923无法在 SCVMM 2008 和 SCVMM 2012 中添加托管主机,错误 2927 (0x8033809d)
929851 Windows Vista 和 Windows Server 2008 中 TCP/IP 的默认动态端口范围已更改