Retrieving a Windows System Unique Interface ID
To obtain the unique device identifier (GUID) for network interfaces on a Windows system, you can utilize PowerShell. Follow these methods to retrieve it:
Method 1: Get Network Interface GUIDs using PowerShell
Run the following PowerShell command to list all network interfaces along with their GUIDs:
Get-NetAdapter | Select-Object Name, InterfaceGuid
This will output something like:
Name InterfaceGuid
---- -------------
Ethernet {b8c2ef47-639d-4b00-96f4-b8e3c8a30618}
Wi-Fi {a5f2c1d2-3341-4a5a-8e98-0e1f10fabc12}
From the output, identify the GUID of the interface you need.
Method 2: Retrieve GUIDs from the Registry
Network adapter GUIDs are stored in the registry under:
HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\
To list all network interface GUIDs from the registry:
Get-ChildItem -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" | Select-Object PSChildName
This will display the GUIDs of all network interfaces.
If you need more details, you can query a specific interface:
$InterfaceGuid = '{b8c2ef47-639d-4b00-96f4-b8e3c8a30618}'
$RegistryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\$InterfaceGuid"
Get-ItemProperty -Path $RegistryPath
Method 3: Find GUID for DNS Cache (Dnscache) Settings
If you're specifically looking for the GUID associated with DNS Cache InterfaceSpecificParameters, use:
Get-ChildItem 'HKLM:\System\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters'
This will list all GUIDs related to Dnscache, which you can use in your $RegistryPath
.
Sample Powershell Output
A sample Powershell output when running the following commands:
1. Get-NetAdapter | Select-Object Name, InterfaceGuid
2. Get-ChildItem -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" | Select-Object PSChildName