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

Viewed 48

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?

1 Answers

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 *IFALIAS HERE*).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 ''
Related