Changing your MAC address in Windows (cont.) Python Script

After writing the previous blog post about manually changing the MAC address of a Windows system, I decided to create a small Python script which would ease up the whole process.

The scripts basic functionality

  • List all network interfaces
  • Change the MAC address of an interface
  • Restart the interface
  • Reset a changed MAC back to default

How does the actual change work?

For more details have a look at the previous blog post. In principle its just creating the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\<ID of NIC, e.g. 0001>\NetworkAddress  

Then set it to the value of the desired MAC address, e.g. 000C29123456. To undo the change, the created key is deleted.

WiFi hassles

Some WiFi network adapters do not accept changing the MAC address to an arbitrary different (valid) address. The usual workaround is setting the first octet of the address to 02, e.g. 020C29123456.


I have used Python to quickly get the script done, however this is possible in any language of your choice. The smartest way is probably a PowerShell script. However, even with Python, this can be easily done with just the standard library.
For portability, I recommend throwing the script into PyInstaller to create a stand-alone executable.

The actual code

You can find the source code as well as a stand-alone executable on GitHub.