Created
February 9, 2016 16:16
-
-
Save vMarkusK/401fa7d079d59d866e6d to your computer and use it in GitHub Desktop.
Set Windows Network Name by MAC from CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Importing the CSV-file containing the NIC configuration. | |
$NICs = Import-Csv "C:\Scripts\NICs.csv" | Where-Object {$_.computername -eq $env:COMPUTERNAME} | |
foreach ($NIC in $NICs) { | |
$NetAdapter = Get-NetAdapter | Where-Object {$_.MacAddress -eq $NIC.MAC} | |
if ($NetAdapter) { | |
Write-Verbose "Found NIC $($NIC.NIC)" | |
# Retrieving the network adapter you want to configure. | |
$NetAdapter = $NetAdapter | Rename-NetAdapter -NewName $NIC.NIC -PassThru | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment