# encoding: ascii
# api: powershell
# title: Rename NICs
# description: Rename Network Adapters to their MAC Addresses
# version: 0.1
# type: class
# author: powershelluser
# license: CC0
# x-poshcode-id: 1452
# x-archived: 2012-06-08T04:15:49
# x-published: 2012-11-03T17:45:00
#
# from: http://www.delltechcenter.com/page/Helpful+PowerShell+Scripts
#
$Shell = New-Object -com shell.application
$NetCons = $Shell.Namespace(0x31)
$NetCons.Items() |
where {$_.Name -like 'Local Area Connection*'} |
foreach{$AdapName=$_.Name; get-WmiObject -class Win32_NetworkAdapter |
where-Object {$_.NetConnectionID -eq $AdapName} |
foreach {$MAC=$_.MacAddress}
$_.Name=$MAC.replace(':','.')
}