Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:54:28+00:00 2026-06-04T23:54:28+00:00

People claim the following VB script works for changing network adapter names. However I

  • 0

People claim the following VB script works for changing network adapter names. However I am having a decidedly difficult time trying to convert this to a c# appliaction that can do the same thing. The problem I seem to be facing is that calls to the NetworkInterface.Name is readonly.

Option Explicit

Const NETWORK_CONNECTIONS = &H31&

Dim sOldName= WScript.Arguments(0)
Dim sNewName= WScript.Arguments(1)

Dim objShell, objFolder, colItems, objItem 

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)

Set colItems = objFolder.Items
For Each objItem in colItems
    If objItem.Name = sOldName Then
        objItem.Name =sNewName 
    End If
Next

I found this which explains it a bit more: http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/11/how-can-i-rename-a-local-area-connection.aspx.

Ok, so there are special folders where the NIC names are stored and you access those folders by binding to the them via the SHELL. How then do you do something like this in c#?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:54:30+00:00Added an answer on June 4, 2026 at 11:54 pm

    You can change the name of a NIC easily through the registry if you know how the registry structure works.

    You will need the NetworkAdapters GUID in order to locate which path to open. To get the network adapter GUID I recommend first querying the WMI “Win32_NetworkAdapter” class. There is a GUID property along with all the other properties needed to identify specific adapters.

    You will notice this GUID in the registry path: {4D36E972-E325-11CE-BFC1-08002BE10318}
    Visit link for information on it:
    http://technet.microsoft.com/en-us/library/cc780532(v=ws.10).aspx

    string fRegistryKey = string.Format(@"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{0}\Connection", NIC_GUID);
    
    RegistryKey RegistryKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, @"\\" + Server.Name);
    
    RegistryKey = RegistryKey.OpenSubKey(fRegistryKey, true); //true is for WriteAble.
    
    RegistryKey.SetValue("Name", "<DesiredAdapterName>");
    

    By design the windows UI will not allow for duplicate NIC names. However, you can force duplicate NIC names via the registry. We have done tests, there seem to be nothing critically effected by having duplicate names. Windows seems to still function fine. You just want to be wary about scripting against NIC names if you don’t incorporate anti-duplicate name logic.

    To create uniqueness you can use the adapter index property associated with the WMI query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some people claim that scala is able to deal with recursive structural types if
I have found some broken threads across the web where people claim to be
I use register_shutdown_function() to let PHP call a function at any time my script
Some claim eval is evil. Any regular HTML page may look like: <script src=some-trendy-js-library.js></script>
I have found that People claim that using all readonly fields in a class
Like several other people, I'm having problems serializing Entity Framework objects, so that I
Some people claim that using namespace std; is bad practice. Others say it's OK
Our Systems people claim that colocating the App server and Database server on the
People buy stuff in a web shop. I take their orders and save them
People use gdb on and off for debugging, of course there are lots of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.