Created
April 5, 2019 15:44
-
-
Save 47star/d73960591624d23c50d9dd08654547b4 to your computer and use it in GitHub Desktop.
Set network adapter name for Windows Server.
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
$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