Is there a way (from the command line) to assign a static ip and name assignment to an ethernet adapter based on the PCI bus/device/function number of the NIC? I am able to do this with the netsh CLI using the name that windows assigns it as such:

netsh interface ip set address name="Ethernet 5" static
netsh interface set interface name = "Ethernet 5" newname = "Example"

But relying on the ethernet label is not going to work in my case, so I'm looking to do this based on the PCI address of each one. I haven't been able to find much information on it, so any suggestions would help.

  • This feels like a roundabout way to solve your problem. First off, only physical Ethernet adapters have PCI addresses, so this won't be a universal solution. Why exactly don't you want to rely on the connection's name? – Twisty Impersonator Jan 30 at 19:03
  • I only want to do this for physical ports so that's ok. I am virtualizing Win 10 on a bare metal hypervisor. When windows reboots as virtualized the names of the connections are always different. The only thing that seems to be steady is the bus/device/function number of the ports. So I need a script that can assign these static IP's without relying on the names. – anthony stoico Jan 30 at 19:08
  • Why not setup a DHCP server with a static IP assignments based on MAC address? The bind dhcp server can I do it I am doing it now. I am sure other dhcp servers can do it. – cybernard Jan 31 at 3:02
  • A DHCP server would be nice to use, but this setup is not always done on a box where everything is already connected to the network. I'd like to be able to assign the IP's to specific physical NICs then later tell my client to plug each piece into its specifically numbered NIC. – anthony stoico Jan 31 at 15:03

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.