Created
May 29, 2024 07:40
-
-
Save mdehaas/a6a66a06704a9191652c4c63601b6090 to your computer and use it in GitHub Desktop.
Disable MAC address randomization on Windows 11
This file contains hidden or 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
| $WhatIf = $false | |
| $Verbose = $true | |
| $Debug = $false | |
| $RegPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}" | |
| ### END CONFIG ##### | |
| $WiFi = Get-NetAdapter -Name "Wi-Fi" | |
| $Keys = Get-ItemProperty -Path "$RegPath\*" -Name "DriverDesc" -ErrorAction SilentlyContinue | |
| foreach ($Key in ($Keys | Where-Object {$_.DriverDesc -eq $WiFi.InterfaceDescription})) { | |
| If ($Key.DriverDesc -eq $WiFi.InterfaceDescription){ | |
| $WiFi.InterfaceDescription | |
| "$RegPath\$($Key.PSChildName)" | |
| New-ItemProperty -Path "$RegPath\$($Key.PSChildName)" -Name "NetworkAddress" -Value $($WiFi.MacAddress) -PropertyType String -Force -WhatIf:$WhatIf -Verbose:$Verbose | Out-Null | |
| if ($Debug) {Get-ItemProperty -Path "$RegPath\$($Key.PSChildName)" -Name "NetworkAddress"} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment