PowerShell Function Set-NetInterfaceName
August 13, 2008 at 3:08 PM
—
Andy Schneider
Now that you are able to set an IP address given a name of a network interface, you may want to change that name.
Here's a quick little function to do that.
1: function Set-InterfaceName { 2: param(
3: [string]$oldName,
4: [string]$newName
5: )
6:
7: $NicInterfaceName = gwmi Win32_NetworkAdapter | where {$_.netconnectionid -eq $oldName} 8: $NicInterfaceName.netconnectionid = $newName
9: $NicInterfaceName.put()
10:
11: }
08c9d9dd-e41b-4ebc-ac03-520f4fbcf68a|0|.0
Posted in:
Tags: