The network is actually read the registry, but if you can get the IP configuration of the machine and other information, later configure IIS is simple.
The following script reads out all available IP addresses, subnet masks, but provincial gateways for the machine:
Option Explicit
Dim WshShell
Dim Snic, Sman
Dim Gateway
Dim IPAddress
Dim SubnetMask
Dim I
Dim Stcpipregkey
Dim BISDHCP
Set WshShell = CreateObject ("Wscript.Shell")
Snic = WshShell.RegRead ("HKLM\Software\Microsoft\Windows Nt\
Currentversion\networkcards\1\servicename ")
If stcpipregkey <> "Microsoft" and Err.Number = 0 Then
Stcpipregkey = "Hklm\system\currentcontrolset\services\"
& Snic & "\parameters\tcpip\"
BISDHCP = WshShell.RegRead (Stcpipregkey & "EnableDHCP")
If bisdhcp Then
Gateway = WshShell.RegRead (Stcpipregkey & "DhcpDefaultGateway")
IPAddress = WshShell.RegRead (Stcpipregkey & "DhcpIPAddress")
SubnetMask = WshShell.RegRead (Stcpipregkey & "Dhcpsubnetmask")
MsgBox ("DefaultGateway:" & Gateway (0) & Chr (a) & Chr (13)
& "IPAddress:" & IPAddress & Chr (a) & Chr (+) & "SubnetMask:" & SubnetMask)
Else
Gateway = WshShell.RegRead (Stcpipregkey & "DefaultGateway")
IPAddress = WshShell.RegRead (Stcpipregkey & "IPAddress")
SubnetMask = WshShell.RegRead (Stcpipregkey & "SubnetMask")
For I=0 to Ubound (IPAddress)-1
MsgBox ("DefaultGateway:" & Gateway (0) & Chr (a) & Chr (13)
& "IPAddress:" & IPAddress (i) & Chr (a) & Chr (+) & "SubnetMask:"
& SubnetMask (i))
Next
End If
End If
Description: The network configuration of the machine is stored in the registration table, under the network card items, so first must know the name of the network card. Then take the registry data, the IP address, and the child
The netmask is in the form of an array (in fact, the registry holds binary data, and VBScript helps us to convert it). Reading the registry in WSH is very simple, specific
Please look at the above procedure.