Access Windows XP SP2 Security Center via WMI

From http://www.pcmag.com/article2/0,1759,1639276,00.asp

According to Microsoft, WMI is the Microsoft implementation of Web-Based Enterprise Management (WBEM), an industry standard for accessing management information on a system. For Windows XP Service Pack 2, Microsoft added new fields or records to keep track of the Firewall and Antivirus information in the WMI database. The WMI database is designed to be accessible via the WBEM API (application program interface) and is available to any program that wants to access the WMI. These programs can be desktop applications written in desktop- or web-based scripting or ActiveX modules. 

make a WMI query in root/SecurityCenter to find out which security product is installed in the system.

Set objSWbemServices = GetObject("winmgmts://./root/SecurityCenter")
Set colFirewall = objSWbemServices.ExecQuery("Select * From antivirusProduct",,48)
For Each objAntiVirusProduct In colFirewall
Echo(" " & objAntiVirusProduct.productUptoDate)
Next

You may also use the WbemScripting.SWbemLocator object 

From http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_21645145.html

Private Sub DumpFirewallInfo()

Dim oLocator    As WbemScripting.SWbemLocator
Dim oService    As WbemScripting.SWbemServicesEx
Dim oFirewalls  As WbemScripting.SWbemObjectSet
Dim oFirewall   As WbemScripting.SWbemObjectEx
Dim oFwMgr      As Variant
   
   
    Set oFwMgr = CreateObject("HNetCfg.FwMgr")
   
    Debug.Print "Checking the Windows Firewall..."
    Debug.Print "Windows Firewal Enabled: " & oFwMgr.LocalPolicy.CurrentProfile.FirewallEnabled
    Debug.Print ""
   
    Set oFwMgr = Nothing
   
   
    Debug.Print "Checking for other installed firewalls..."
   
    Set oLocator = New WbemScripting.SWbemLocator
    Set oService = oLocator.ConnectServer(".", "root/SecurityCenter")
    oService.Security_.ImpersonationLevel = 3

    Set oFirewalls = oService.ExecQuery("SELECT * FROM FirewallProduct") ' This could also be "AntivirusProduct"
   
    For Each oFirewall In oFirewalls
        Debug.Print "Company:       " & vbTab & oFirewall.CompanyName
        Debug.Print "Firewall Name: " & vbTab & oFirewall.DisplayName
        Debug.Print "Enabled:       " & vbTab & Format$(oFirewall.Enabled)
        Debug.Print "Version:       " & vbTab & oFirewall.versionNumber
        Debug.Print ""
    Next oFirewall
   
    Set oFirewall = Nothing
    Set oFirewalls = Nothing
    Set oService = Nothing
    Set oLocator = Nothing

End Sub

more informatin about Wbem Scripting can be found at http://msdn.microsoft.com/library/en-us/wmisdk/wmi/creating_an_object_using_vbscript.asp.

Windows.SecurityCenter.WscBrokerManager 是与 Windows 安全中心相关的一个组件。通常,它在 Windows 系统的安全管理方面发挥着重要作用。 从检测机制来看,Windows Security Center 采用双层检测方法,一层是手动检测,另一层是通过 WMI。手动检测模式下,Windows Security Center 搜索注册表键值和第三方厂商提供给微软的文件来鉴别;WMI 模式下,软件生产厂商判断它们的产品运行状态,通过 WMI Provider 回报给 Windows Security Center,虽然这里未直接提及 WscBrokerManager,但可以推测它在安全检测流程中可能参与信息的收集、整合或者管理工作,例如协助收集手动检测和 WMI 检测所得到的信息,将这些信息进行整理后反馈给安全中心以进行综合判断 [^1]。 关于其使用方法,一般来说,开发者可以通过 Windows 提供的相关 API 来调用 WscBrokerManager 进行安全状态的查询等操作。例如在一些脚本或者程序中,可以使用特定的代码来初始化 WscBrokerManager 对象,然后调用其方法获取系统的安全状态信息,如是否安装了防病毒软件、防火墙是否开启等。以下是一个简单的伪代码示例: ```python # 伪代码示例,实际使用需要使用 Windows 相关的 API 库 import some_windows_api_library # 初始化 WscBrokerManager 对象 wsc_manager = some_windows_api_library.WscBrokerManager() # 调用方法获取安全状态信息 security_status = wsc_manager.get_security_status() print(security_status) ``` 其主要功能可能包括: 1. 安全状态监测:实时监测系统的各项安全组件的状态,如防病毒软件、防火墙、实时保护等是否正常运行。 2. 信息整合:将不同检测方式(如手动检测和 WMI 检测)得到的安全信息进行整合,以便安全中心进行统一的分析和判断。 3. 状态反馈:将系统的安全状态信息反馈给 Windows 安全中心,让用户能够直观地了解系统的安全状况。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值