Skip to content

Instantly share code, notes, and snippets.

@47star
Created April 5, 2019 15:44
Show Gist options
  • Save 47star/d73960591624d23c50d9dd08654547b4 to your computer and use it in GitHub Desktop.
Save 47star/d73960591624d23c50d9dd08654547b4 to your computer and use it in GitHub Desktop.
Set network adapter name for Windows Server.
$hardwareid = ((gwmi Win32_PnPSignedDriver -Filter "Description = 'Microsoft Hyper-V Network Adapter'").HardwareID[0]).ToUpper();
foreach ($drivername in (gwmi Win32_PnPSignedDriver -Filter "Description = 'Microsoft Hyper-V Network Adapter'").DeviceID) {
$driverid = $drivername.Replace($hardwareid, "").Replace("\", "").ToLower();
$registryPath = "HKLM:\SYSTEM\ControlSet001\Enum\VMBUS\" + $hardwareid.Replace("VMBUS\", "").ToLower() + "\" + $driverid;
Set-ItemProperty -Path $registryPath -Name "FriendlyName" -Value "NIC Name Goes Here"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment