다음을 통해 공유


How to query network adapter for IPv6 protocol?

Assuming you need it in script, PowerShell:

# computername

$MachineName = 'localhost'

 

# open HKLM reg on $MachineName

$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $MachineName)

 

# open subKey SYSTEMCurrentControlSetservicesTCPIP6Linkage

$regKey = $reg.OpenSubKey("SYSTEM\CurrentControlSet\services\TCPIP6\Linkage")

 

# get the values from the name 'Bind'

# e.g. Device{A2B312D5-A133-4779-B21B-5B3ED82B6DCF}

$bind = $regKey.GetValue("bind")

 

# get adapters that are IP enabled : e.g. IPv4 or IPv6 is active

$adapters = gwmi -computer $MachineName Win32_NetworkAdapterConfiguration|?{$_.IPEnabled}

 

# for each adapter check if his GUID is in the Bind values and display info regarding IPv6 binding

foreach ( $adap in $adapters)

   
{

       
# get GUID of the adapter

           
$guid = $adap.SettingID

           
# get the name of the adapter to be used to display info

       
$name = (gwmi -computer $MachineName Win32_NetworkAdapter|?{$_.guid -eq $guid}).NetConnectionID

           
# buid the deviceGUID string from the GUID of the adapter

       
$device_guid = 'Device'+$guid

           
# check if the bind key contains the adapter guid

       
if($bind -contains $device_guid)

            
{write-host "Computer $MachineName -> IPv6 OK in adapter: $name" }

       
else {write-host "Computer $MachineName -> IPv6 not bind on adapter: $name" }

   
}

Write `nDone