"tree leafs" <treeleafs@newsgroup> wrote in message
> I am looking for some startup script that can detect PC's IP subnet.
> Thanks in advance.
This code fragment uses WMI to return the PC's IP address. You can easily
extract the subnet.
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")
For Each objNetAdapter In colNetAdapters
WScript.Echo "IP_Address=" & objNetAdapter.IPAddress(0)