简体   繁体   中英

ipconfig shows IAID, DUID for IPv6 config; where can I get these in native PowerShell?

I'm either missing something incredibly obvious or... I don't know what. I've scoured support sites for this information, but I keep finding either server-side information or IPv4-era documentation for finding configuration details.

In order to manage IPv6 on my network more coherently, I want to be able to programmatically find the DUID + IAID pair for any DHCPv6-enabled NIC on a workstation. The information appears plainly when one runs ipconfig /all ,

DHCPv6 IAID . . . . . . . . . . . : nnnnnnnnn
DHCPv6 Client DUID. . . . . . . . : nn-nn-nn-[etc.]

What is the PowerShell-native way to find these?

All right, well, I continue to be stumped that there's no more straightforward and plainly documented way to do this, but at least this works as far as I can see. Anyone have a better approach?

$nicguid = (get-netadapter gdstudionic).deviceid
$niciaid = get-itempropertyvalue "HKLM:System\CurrentControlSet\services\TCPIP6\Parameters\interfaces\$nicguid" -name "dhcpv6iaid"
$nicduid = (get-itempropertyvalue "HKLM:System\CurrentControlSet\services\TCPIP6\Parameters" -name "dhcpv6duid") -join ''

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM