Access Windows XP SP2 Security Center via WMI
2006-09-18 04:49
429 查看
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.
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.
相关文章推荐
- Access Windows XP SP2 Security Center via WMI铪铪铪
- Hacking Windows XP SP2 Security
- Windows XP Professional Corporate SP2 Integrated March 2007 ISO
- 寻得一个 Windows XP Professional With SP2 VOL CHS 下载地址
- Microsoft Windows XP SP2 With Update 200801 bida[WMZ] 2008贺岁安装版
- Hacking Windows XP SP3 Via MS11-006 Windows Shell Graphics Processing Vulnerability
- Is the Quartus® II software compatible with Microsoft Windows XP SP2
- 番茄花园 Windows XP Pro SP2 免激活 V3.5迅雷高速下载
- 浏览器集成教学 自定义浏览器(Updated for Windows XP SP2)
- 番茄花园 Windows XP Pro SP2 美化版 V 6.2
- Windows 2000, XP SP2 和 Vista 将结束官方技术支持
- install aspnet_regiis.exe for aspx execution in Windows XP sp2
- Windows中的桌面管理 安全与访问权限 Desktop Security and Access Rights
- 寻得一个 Windows XP Professional With SP2 VOL CHS 下载地址
- How to re-install WMI for Windows XP
- “电脑疯子”更名启示:Windows XP pro with sp2 VOL(MSDN)中文版(正名)
- Windows 2000, XP SP2 and Vista End of Life Support
- Windows 2000, XP SP2, Vista 支持即将到期
- Windows 2000, XP SP2 and Vista 微软将停止支持
- Windows 98/2000/xp/2003访问XP(sp2)可能的用户问题