Contact Info

Crumbtrail

ActiveXperts.com » Administration » VBScript Collection » Networking » Home Networking

Home Networking Scripts - VBScript sample code

List Home Networking Connections
List Home Networking Connection Properties
List Home Networking Firewall Logging Settings
List Home Networking Firewall Settings
List Home Networking ICMP Settings
List Home Networking Port Mappings
List Home Networking Port Mapping Protocols
List Home Networking ICS Settings
Modify Home Networking Firewall Logging Settings
Modify Home Networking Firewall Settings


You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.



List Home Networking Connections


Returns the properties of each Internet Connection Firewall connection.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery("Select * from HNet_Connection")

For Each objItem in colItems
    Wscript.Echo "GUID: " & objItem.GUID
    Wscript.Echo "Is LAN Connection: " & objItem.IsLANConnection
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Phone Book Path: " & objItem.PhoneBookPath
Next
	

List Home Networking Connection Properties


Enumerates Internet Connection Firewall connection properties.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery _
    ("Select * from HNet_ConnectionProperties")

For Each objItem in colItems
    Wscript.Echo "Connection: " & objItem.Connection
    Wscript.Echo "Is Bridge: " & objItem.IsBridge
    Wscript.Echo "Is Bridge Member: " & objItem.IsBridgeMember
    Wscript.Echo "Is Firewalled: " & objItem.IsFirewalled
    Wscript.Echo "Is ICS Private: " & objItem.IsICSPrivate
    Wscript.Echo "Is ICS Public: " & objItem.IsICSPublic
Next
	

List Home Networking Firewall Logging Settings


Enumerates the configuration settings for Internet Connection Firewall logging.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery _
    ("Select * from HNet_FirewallLoggingSettings")

For Each objItem in colItems
    Wscript.Echo "ID: " & objItem.ID
    Wscript.Echo "Log Connections: " & objItem.LogConnections
    Wscript.Echo "Log Dropped Packets: " & objItem.LogDroppedPackets
    Wscript.Echo "Max File Size: " & objItem.MaxFileSize
    Wscript.Echo "Path: " & objItem.Path
Next
	

List Home Networking Firewall Settings


Enumerates the inbound and outbound configuration settings for Internet Connection Firewall.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery("Select * from HNet_FwIcmpSettings")

For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Allow Inbound Echo request: " & _
        objItem.AllowInboundEchoRequest
    Wscript.Echo "Allow Inbound Mask Requestt: " & _
        objItem.AllowInboundMaskRequest
    Wscript.Echo "Allow Inbound Router Request: " & _
        objItem.AllowInboundRouterRequest
    Wscript.Echo "Allow Inbound Timestamp Request: " & _
        objItem.AllowInboundTimestampRequest
    Wscript.Echo "Allow Outbound Destination Unreachable: " & _
        objItem.AllowOutboundDestinationUnreachable
    Wscript.Echo "Allow Outbound Parameter Problem: " & _
        objItem.AllowOutboundParameterProblem
    Wscript.Echo "Allow Outbound Source Quench: " & _
        objItem.AllowOutboundSourceQuench
    Wscript.Echo "Allow Outbound Time Exceeded: " & _
        objItem.AllowOutboundTimeExceeded
    Wscript.Echo "Allow redirect: " & objItem.AllowRedirect
Next
	

List Home Networking ICMP Settings


Enumerates the ICMP settings for Internet Connection Firewall.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery _
    ("Select * from HNet_ConnectionICMPSetting")

For Each objItem in colItems
    Wscript.Echo "Connection: " & objItem.Connection
    Wscript.Echo "ICMP Settings: " & objItem.ICMPSettings
Next
	

List Home Networking Port Mappings


Returns a list of all the Internet Connection Firewall port mappings on a computer.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery _
    ("Select * from HNet_ConnectionPortMapping2")

For Each objItem in colItems
    Wscript.Echo "Connection: " & objItem.Connection
    Wscript.Echo "Enabled: " & objItem.Enabled
    Wscript.Echo "Name Active: " & objItem.NameActive
    Wscript.Echo "Protocol: " & objItem.Protocol
    Wscript.Echo "Target IP Address: " & objItem.TargetIPAddress
    Wscript.Echo "Target Name: " & objItem.TargetName
    Wscript.Echo "Target Port: " & objItem.TargetPort
Next
	

List Home Networking Port Mapping Protocols


Enumerates all the Internet Connection Firewall port mapping protocols on a computer.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery _
    ("Select * from HNet_PortMappingProtocol")

For Each objItem in colItems
    Wscript.Echo "Built In: " & objItem.BuiltIn
    Wscript.Echo "ID: " & objItem.ID
    Wscript.Echo "IP Protocol: " & objItem.IPProtocol
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Port: " & objItem.Port
Next
	

List Home Networking ICS Settings


Reports whether the Internet Connection Firewall settings have been configured to allow DHCP and DNS.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery("Select * from HNet_ICSSettings")

For Each objItem in colItems
    Wscript.Echo "DHCP Enabled: " & objItem.DHCPEnabled
    Wscript.Echo "DNS Enabled: " & objItem.DNSEnabled
    Wscript.Echo "ID: " & objItem.ID
Next
	

Modify Home Networking Firewall Logging Settings


Disables the logging of dropped packets with Internet Connection Firewall. To enable logging of dropped packets, simply set the value of the property LogDroppedPackets to True.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery _
    ("Select * from HNet_FirewallLoggingSettings")

For Each objItem in colItems
    objItem.LogDroppedPackets = False
    objItem.Put_
Next
	

Modify Home Networking Firewall Settings


Disables the ability of the Internet Connection Firewall to allow inbound echo requests. To enable the ability to allow inbound echo requests, simply set the value of the property AlllowInboundEchoRequest to True.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery("Select * from HNet_FwIcmpSettings")

For Each objItem in colItems
    objItem.AllowInboundEchoRequest = False
    objItem.Put_
Next