Vbscript to check windows firewall status
Hi ,
I have wrote a vbscript to check windows firewall status. But this is not seems to be working.when I run script it shows issue with line 23. But I cant understand what need to be changed and also is this enough to check all other firewall profile as well ? can any one help here please ?
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 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
anonymous_9363
8 years ago
Posted by:
aragorn.2003
8 years ago