Contact Info

Crumbtrail » Administration » Scripts » WMI Performance Counters » VBScript

NetFirewallProfile - WMI sample in VBScript

The foundations for Manageability in Windows 2019/2012/2008/ and Windows 10/8/7/Vista/XP are Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself.

On this site, you can find many WMI samples.

The NetFirewallProfile WMI class can be used in ActiveXperts Network Monitor to monitor your servers.



Set objWMIService = GetObject("winmgmts:\\.\root\StandardCimv2")

Set colItems = objWMIService.ExecQuery("Select * From MSFT_NetFirewallProfile")

For Each objItem in colItems
	WScript.Echo "AllowInboundRules:" & objItem.AllowInboundRules
	WScript.Echo "AllowLocalFirewallRules:" & objItem.AllowLocalFirewallRules
	WScript.Echo "AllowLocalIPsecRules:" & objItem.AllowLocalIPsecRules
	WScript.Echo "AllowUnicastResponseToMulticast:" & objItem.AllowUnicastResponseToMulticast
	WScript.Echo "AllowUserApps:" & objItem.AllowUserApps
	WScript.Echo "AllowUserPorts:" & objItem.AllowUserPorts
	WScript.Echo "Caption:" & objItem.Caption
	WScript.Echo "DefaultInboundAction:" & objItem.DefaultInboundAction
	WScript.Echo "DefaultOutboundAction:" & objItem.DefaultOutboundAction
	WScript.Echo "Description:" & objItem.Description
	WScript.Echo "DisabledInterfaceAliases:" & Join(objItem.DisabledInterfaceAliases)
	WScript.Echo "ElementName:" & objItem.ElementName
	WScript.Echo "Enabled:" & objItem.Enabled
	WScript.Echo "EnableStealthModeForIPsec:" & objItem.EnableStealthModeForIPsec
	WScript.Echo "InstanceID:" & objItem.InstanceID
	WScript.Echo "LogAllowed:" & objItem.LogAllowed
	WScript.Echo "LogBlocked:" & objItem.LogBlocked
	WScript.Echo "LogFileName:" & objItem.LogFileName
	WScript.Echo "LogIgnored:" & objItem.LogIgnored
	WScript.Echo "LogMaxSizeKilobytes:" & objItem.LogMaxSizeKilobytes
	WScript.Echo "Name:" & objItem.Name
	WScript.Echo "NotifyOnListen:" & objItem.NotifyOnListen
	WScript.Echo ""
	WScript.Echo "########"
	WScript.Echo ""