文档库 最新最全的文档下载
当前位置:文档库 › 如何修改WMI端口

如何修改WMI端口

1.
修改为24158固定Port的方法。
Setting Up a Fixed Port for WMI
WMI runs as part of a shared service host with ports assigned through DCOM by default. Starting with Windows Vista, you can set up the WMI service to run as the only process in a separate host and specify a fixed port.

A fixed port makes WMI easier to use behind firewalls, but in Windows Vista you cannot use scripts that make asynchronous calls. For more information about asynchronous calls, see Calling a Method.

The following procedure is an automated setup to allow WMI to have a fixed port. The procedure uses the winmgmt command-line tool.

To set up a fixed port for WMI

1.At the command prompt, type winmgmt -standalonehost
2.Stop the WMI service by typing the command net stop "Windows Management Instrumentation"
3.Restart the WMI service again in a new service host by typing net start "Windows Management Instrumentation"
4.Establish a new port number for the WMI service by typing netsh firewall add portopening port=24158 name=WMIFixedPort

2.修改为其他Port的方法。
必须确保为与 WMI 相关的 DCOM 通信打开了 TCP 端口 135。若要控制用于 WMI 通信的其他端口,则可以配置固定端口。有关如何执行此操作的信息,请参阅 MSDN 中的“为 WMI 设置固定端口”(https://www.wendangku.net/doc/b27234496.html,/fwlink/?LinkId=109867)(可能为英文网页)。若要在基于 Windows Server 2008 的服务器上使用此过程,请注意以下附加信息:

如果没有使用本地 Administrator 帐户登录,则必须从权限提升的命令提示符运行命令。若要打开权限提升的命令提示符,请单击「开始」,右键单击“命令提示符”,然后单击“以管理员身份运行”。


该过程显示如何为 WMI 通信配置 TCP 端口 24158。默认情况下,winmgmt -standalonehost 命令将 Windows Management Instrumentation 服务 (Winmgmt) 移动到具有固定 DCOM 终结点 ncacn_ip_tcp.0.24158 的独立 Svchost 进程。

若要指定其他端口号,请勿使用 winmgmt -standalonehost 命令。而必须执行以下操作。

指定与默认端口号不同的端口号的步骤
1.使用组件服务将 WMI 的固定 DCOM 终结点配置为所需的端口。若要执行此操作,请按下列步骤执行:

1.打开“组件服务”。若要打开组件服务,请单击「开始」,指向“管理工具”,然后单击“组件服务”。


2.在控制台树中,依次展开“组件服务”、“计算机”和“我的电脑”,然后单击“DCOM 配置”。


3.在中间的窗格中,右键单击 Windows Management Instrumentation,然后单击“属性”。


4.单击“终结点”选项卡,然后单击“属性”或“添加”,具体取决于是否已经存在自定义条目。


5.单击“使用静态终结点”,输入要使用的端口号,然后单击“确定”两次。


2.重新启动 Winmgmt 服务使更改生效。

若要重新启动该服务,请从命令行运行命令 net stop winmgmt 和 net start winmgmt。

3.在将 port 参数设置为在组件服务中指定的同一端口的情况下运行 netsh 命令。(请参阅下面带有项目符号的项,了解有关 netsh 命令语法的详细信息。)

当运行 netsh 命令创建防火墙规则时,必须包含 protocol 参数,并将协议类型指定为 TCP。下面是此命令语法的一个示例:

netsh firewall add portopening protocol=TCP port=24158 profile=domain name=WMIFixedPort

相关文档
相关文档 最新文档