初めて書き込みさせて頂きます。
現在XP SP2以降、Vista OSのセキュリティセンターのステータスをうまく拾う事が出来ずにいます。
最終的には、インストールされているセキュリティソフト(ウィルス対策ソフト、ファイヤーウォールソフト)の名称とそのソフトの有効期限が切れているかどうかが調べられれば良いので、手段は何でも良いのですが、WMIを利用した場合の以下サンプルコードで上手く動作させる事が出来ません。
例えば以下のようなサンプルコードで実行すると、Vistaではカスペルスキーがインストールされていてるのに"AntiVirus Product Not Installed"
を返してきます。
strComputer = "."
Set oWMI = GetObject("winmgmts:{impersonationlevel=impersonate}!\\" _
& strComputer & "\root\SecurityCenter")
Set colAV = oWMI.ExecQuery("Select * from AntiVirusProduct")
If colAV.Count = 0 Then
MsgBox "AntiVirus Product Not Installed"
Else
For Each objAntiVirusProduct In colAV
MsgBox "CompanyName : " & objAntiVirusProduct.CompanyName
MsgBox "VersionNumber : " & objAntiVirusProduct.versionNumber
MsgBox "InstanceGuid : " & objAntiVirusProduct.instanceGuid
MsgBox "onAccessScanningEnabled : " & objAntiVirusProduct.onAccessScanningEnabled
MsgBox "ProductUptoDate : " & objAntiVirusProduct.productUptoDate
MsgBox "DisplayName : " & objAntiVirusProduct.DisplayName
Next
End If
何か有効な手法等があればご教授頂けると幸いです。
宜しくお願い致します。
SDKにある、netfw.h が参考になるかと・・・
以上。
オショウ様
回答有難うございました。
自分はSDKのnetfw.hを参考に出来るレベルでは無い事が分かりました。
その代わりに以下のコードでVistaとXPを使い分けると何となくそれらしい情報を取得出来たので、これで対応してみたいと思います。
Vistaの場合
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\SecurityCenter2")
XPの場合
Set oWMI = GetObject("winmgmts:{impersonationlevel=impersonate}!\\" & strComputer & "\root\SecurityCenter")
有難うございました。
ツイート | ![]() |