用于检查Windows防火墙状态的脚本

时间:2016-04-26 11:53:28

标签: vbscript

我写了一个脚本来检查Windows防火墙状态。但这似乎并没有起作用。当我运行脚本时,它显示了第23行的问题。但我无法理解需要更改的内容,这也足以检查所有其他防火墙配置文件吗?请问有人帮忙吗?

Option Explicit

'Create Shell object
Dim objShell
Set objShell = CreateObject("Shell.Application")

'Declare Firewall variables
Dim fwMgr
Dim profile

' Firewall objects have to be created after making sure
' the service is running. If the service isn't running,
' the script will fail.

' Create the firewall manager object.
Set fwMgr = CreateObject("HNetCfg.FwMgr")

' Get the current profile for the local firewall policy.
Set profile = fwMgr.LocalPolicy.CurrentProfile

'Verify that the Firewall is enabled. If it is, then disable it.
If profile.FirewallEnabled = True Then
    profile.FirewallEnabled = False
End If
WScript.Echo("tr_FirewallEnabled: " & profile.FirewallEnabled)

0 个答案:

没有答案