Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the urvanov-syntax-highlighter domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in C:\home\site\wwwroot\wp-includes\functions.php on line 6114
Change MAC Address with PowerShell of a Wireless Adapter – A Geeks World

Change MAC Address with PowerShell of a Wireless Adapter

As I mentioned in my post a week ago, I’m commuting each day and there is a 200MB Quota on the Wireless Network. Luckily it’s based on the MAC Address of the WiFi Card, so it’s quite easy to get another 200MB Quota if you want  😉

wifi1

Here is my small powershell script that automatically Releases the IP Address, set’s a new random MAC Address and Re-Connects to the SSID, all done in a second or two.
Yay! Another 200MB Quota to burn.

 

I’m using a Window 10 client with Hyper-V, and I’ve created a Virtual NIC for the WiFi adapter, that’s why it’s called ‘vEthernet (External Wi-Fi)’.  But you should be able to use the script with a normal WiFi Adapter too.

I’m using a Virtual WiFi Adapter, to be able to give my Virtual Machines access to internet also when I’m without a LAN.

Here is the script for creating a Virtual WiFi NIC;

 

 

7 thoughts on “Change MAC Address with PowerShell of a Wireless Adapter”

  1. Please note that the “” got screwed up with the font here. So don’t copy and paste from the comment section, do the change manually in your script or you will get some problems.

  2. Just enter the MAC you would like to use on line 02 like this;

    function random-mac {
    $mac = “02BBBBBB”
    while ($mac.length -lt 12)
    {
    $mac += “{0:X}” -f $(get-random -min 0 -max 16)
    }

    $Delimiter = “-”
    for ($i = 0 ; $i -le 10 ; $i += 2)
    { $newmac += $mac.substring($i,2) + $Delimiter }
    $setmac = $newmac.substring(0,$($newmac.length – $Delimiter.length))
    $setmac
    }

    It will add the XX XX random numbers on top of that.

  3. Thanks. Thats pretty cool. I want to use this to define a more specific range of mac addresses that I can pre-authorize during a PXE build process. So I’d like to pick from a pool starting with 02-BB-BB-BB-XX-XX . (x’s obviously being the randomized chars) How would I do that ?

  4. I will add a feature to revert back to the original address.

  5. How do you retrieve your original MAC after you use the script ?

    Do you know an easy way to run the script automatically each XX minutes, like at a coffee shop where the Internet limit is 15 minutes, having it to change MAC each 13 minutes would be useful 😉

    Regards !

Leave a Reply