Asked by:
Script to change workstation interface name

General discussion
-
Hi there,
I'm not a script or powershell guy, and hope someone in this forum can help me with this.
I found this command netsh interface set interface name=”Local Area Connection” newname=”Ethernet” online which can change workstation interface name, but the problem is that I have no idea what current interface name is on those workstations, they may all have the same name or may have several different names, and I can't run this command to those workstations one by one. Is there any "wildcard" function, and change them by using the above command? Thank you.
- Changed type Bill_Stewart Monday, July 30, 2018 9:57 PM
- Moved by Bill_Stewart Monday, July 30, 2018 9:58 PM This is not "research information for me" forum
Thursday, July 5, 2018 3:00 PM
All replies
-
Please read the following to set your expectations:
This forum is for scripting questions rather than script requests
-- Bill Stewart [Bill_Stewart]
Thursday, July 5, 2018 3:11 PM -
Hi,
You can try using below code if you know name of any one of network adapter's name and then use same code for rest of the machine's adapters:-
$computers=Get-Content-PathC:\Computers.txt
$wmi=Get-WmiObject-ClassWin32_NetworkAdapter-Filter"NetConnectionID = 'Local Area Connection'"
$wmi.NetConnectionID ='Renamed Connection'
$wmi.Put()
Let me know if it helps and mark as answer if your purpose is resolved.
Thanks,
Ravi
Thursday, July 5, 2018 4:04 PM -
This cmd-command will cycle through your interfaces and search for an interface name that contain the string: "local"
If there is a match… the chained command will rename the interface to "Ethernet"
for /f "tokens=1-3,*" %a in ('netsh interface show interface') do @echo %d | find /i "local" && netsh interface set interface name="%d" newname="Ethernet"
- Edited by I-MANjuel Friday, July 6, 2018 9:06 PM
Friday, July 6, 2018 6:30 PM -
Rename-NetAdapter -Name 'Wireless Network Connection -NewName Wireless
OR
Get-NetAdapter | Where{$_.Status -eq 'Up'} | Rename-NetAdapter -NewName Wireless
\_(ツ)_/
Friday, July 6, 2018 8:30 PM -
Friday, July 6, 2018 8:32 PM