Python Forum
How to rename Network Interface name
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to rename Network Interface name
#5
(Jan-30-2019, 04:54 PM)buran Wrote: To disable Wi-Fi
>>> import subprocess
>>> subprocess.call(['netsh', 'interface', 'set', 'interface', 'name="Wi-Fi"', 'admin="DISABLED"'])

0
You need to run cmd in elevated mode (i.e. Run As Administrator)
Change the name if the adapter name is not Wi-Fi, e.g. Wireless Network Connection, etc.

Use this as example how to rename interface
>>> subprocess.call(['netsh', 'interface', 'set', 'interface', 'name="TPALAN"', 'newname="TPALAN2"'])

Perfect Thanks Buran.
One more questions: I am trying to get input function to get Interface name from User, but it doesn't accept input value. can you please help?
import subprocess
import os

changeName=input("Enter the Interface name:")
print(changeName)
subprocess.call(['netsh', 'interface', 'set', 'interface', 'name="Wi-Fi"', 'newname=changeName'])
os.system("netsh interface show interface")
Output:
Enter the Interface name:Wi-Fi123 Wi-Fi123 Admin State State Type Interface Name ------------------------------------------------------------------------- Disabled Disconnected Dedicated changeName Disabled Disconnected Dedicated TPALAN Enabled Connected Dedicated TPALANDOC Process finished with exit code 0
It doesn't accept the Value from Input function.
Please help.
Thank you
Reply


Messages In This Thread
RE: How to rename Network Interface name - by buran - Jan-30-2019, 04:54 PM
RE: How to rename Network Interface name - by aniyanetworks - Jan-30-2019, 05:15 PM
RE: How to rename Network Interface name - by buran - Jan-30-2019, 05:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  os.system("netsh interface set interface 'Wi-Fi' enabled") aniyanetworks 12 10,691 Jan-18-2019, 04:07 AM
Last Post: aniyanetworks

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020