Helpful PowerShell ScriptsThis is a featured page

Disclaimer: These scripts have undergone very limited testing and are not officially supported by Dell.


Rename Adapters to their MAC Addresses

This script will take any adapters that begin with the name "Local Area Connection" and rename them to their MAC addresses. This can be extremely useful in a blade server environment where performing the mappings from physical adapter to logical adapter can be tedious. If you are running a blade environment, check out the post on the blade configuration setup in Virtualization Solutions Engineering lab that details a sample deployment(http://www.delltechcenter.com/page/Hyper-V+R2+Lab+Configuration).

To execute, copy the contents below into a batch file and run it.


@echo off&Title=Set Adapter Names &MODE CON: COLS=100 LINES=20
powershell -nologo -command "Write-Host 'Attempting to rename adapters named Local Area Connection* to their MAC address'; $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}; Write-Host Renaming $_.Name to $MAC; $_.Name=$MAC.replace(':','.')}" | more
pause

Before:


Network Connections Default Naming

After:


Network Connections - Renamed to MAC



RyanW-Dell
RyanW-Dell
Latest page update: made by RyanW-Dell , Oct 26 2009, 8:00 PM EDT (about this update About This Update RyanW-Dell Edited by RyanW-Dell

51 words added

view changes

- complete history)
Keyword tags: Hyper-V PowerShell
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)