WMI是什么?
WMI是Windows 2K/XP管理系统的核心;对于其他的Win32操作系统,WMI是一个有用的插件。WMI以CIMOM为基础,CIMOM即公共信息模型对象管理器(Common Information Model Object Manager),是一个描述操作系统构成单元的对象数据库,为MMC和脚本程序提供了一个访问操作系统构成单元的公共接口。有了WMI,工具软件和脚本程序访问操作系统的不同部分时不需要使用不同的API;相反,操作系统的不同部分都可以插入WMI,如图一所示(该图来自MSDN),工具软件和WMI可以方便地读写WMI。
测试WMI是否打开,
1. Run “wbemtest”
2. 然后 On the resulting Window click Connect... and add the \\
3. Click Connect and if you get an error
Most of the time you will receive one of the following errors:
-
Access is denied - This one should be obvious. You will want to look up enabling DCOM permissions or WMI permissions.
-
RPC Server is unavailable - The Remote Procedure Call is failing. Either the computer name can't be resolved or a firewall is blocking WMI access.
Enable WMI through the Windows Firewall
To enable WMI on Windows 7 for a single computer simply navigate to the advanced settings of the Windows Firewall and navigate to the section for Windows Management Instrumentation in both the inbound and outbound rules and enable them:
In most cases this will be enough. Or you may need to dig a little deeper.
Enable WMI with Group Policy for Windows 7
If you see this works and you need to enable WMI via Group Policy for multiple computers perform the following steps for Windows 7
- Edit the group policy object you wish to put these settings into.
- Expand the Computer Config > Policies > Windows Settings > Security Settings > Windows Firewall with Advanced Security > Windows Firewall with Advanced Security > Inbound Rules node.
- Right-click in the working area and choose New Rule...
- Choose the Predefined option, and select Windows Management Instrumentation (WMI) from the drop-down list, Next.
- There are a number of options here, but I tend to just select one: the (WMI-In) option with the Domain profile value. If you aren't sure what you need, then just remember you can come back and add the others later. Next button.
- Allow the connection > Finish.