Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set Windows Network Name by MAC from CSV
# 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
You can’t perform that action at this time.