IP Configuration for Windows NT
Keywords: IPCONFIG
Question:
I am trying to extract the IP information (address and Gateway) from an NT machine. I saw the posting for Windows 95 using the WINIPCFG command and it works great under 95. Unfortunately NT uses a DOS window to display the IP configuration and I have not been able to extract the information.Answer:
- Even easier under NT, just use the IPCONFIG.EXE command with all it's options. Try IPCONFIG /? to see them all, but all this information is attainable including DHCP info.
- Using the Internet extender, there is a cute way to get the local ip address by using the wxGetInfo commands. Best way I've seen yet.
- Regular Winbatch method:
Try this code below. It will extract all IP information from the registry from nt40
IPRegKey=RegOpenKey(@REGMACHINE,"System\CurrentControlSet\Services\E100B1\Parameters\TCPIP") TCPIP=RegQueryMulSz(IPRegKey,"[IPAddress]",@tab) Gateway=RegQueryMulSz(IPRegKey,"[DefaultGateway]",@tab) SubNet=RegQueryMulSz(IPRegKey,"[SubnetMask]",@tab) RegCloseKey(IPRegKey) HostName =RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\TCPIP\Parameters[Hostname]") DNS =RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\TCPIP\Parameters[NameServer]") DNSDOM = RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\TCPIP\Parameters[Domain]") USEDNS =RegQueryDword(@REGMACHINE,"System\ControlSet001\Services\NetBT\Parameters[EnableDNS]") If USEDNS == "1" USEDNS = "Yes" EndIF
Article ID: W12655Filename: Get IP Address Windows NT4.0.txt