Vbscript to check windows firewall status
04/26/2016 1950 views
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 ?
'Create Shell object
set objShell = CreateObject("Shell.Application")
'Declare Firewall variables
' 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
WScript.Echo("tr_FirewallEnabled: " & profile.FirewallEnabled)