JSI Tip 9655. How can I locate the registry key for the TCPIP service parameters interface for my LAN?
August 21, 2005
If you wanted to configure the TCP/IP parameters for your LAN that are located at HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersInterfaces\{ID for Adapter} you would need to locate the {ID for Adapter} key.
NOTE: Some other TCP/IP registry values are located using How do I retrieve an interface {GUID}?.
I have scripted TCPIFKEY.bat to locate the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersInterfaces\{ID for Adapter} key for your LAN.
The syntax for using TCPIFKEY.bat is:
TCPIFKEY Mask Key
Where:
MasK is the IP address string that uniquely identifies your LAN, like 192.168.0. or 192.168.Key is a call directed environment variable that will contain the full key. If the key is not found, Key will be set to NONE.
NOTE: TCPIFKEY.bat uses REG.EXE, built into Windows XP and Windows Server 2003, or REG.EXE from the Windows 2000 Support Tools on the CD-ROM, which must be available in your PATH.
TCPIFKEY.bat contains:
@echo offif {%2}=={} @echo Syntax TCPIFKEY Mask key&goto :EOFsetlocal ENABLEDELAYEDEXPANSIONset mask=%1set mask=%mask:"=%set qry=reg query HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersInterfaces /sSet OK=Nset key=NONEfor /f "Tokens=*" %%a in ('%qry%') do ( set work=%%a if "!OK!" NEQ "Y" if "!work:~0,18!" EQU "HKEY_LOCAL_MACHINE" set OK=X&set key=%%a for /f "Tokens=*" %%x in ('@echo %%a^|FIND "%mask%"') do ( if "!OK!" EQU "X" set OK=Y ))if "%OK%" NEQ "Y" set key=NONEendlocal&set %2=%key%
About the Author
You May Also Like