vb6 Mac address lock work around

3 posts in this topic


Short story even shorter, Im too poor to afford internet service. I have an xfinity wifi hotspot near me, as well as a net cafe, which both give free internet time for a short while and then boot you off.
Xfinity for example, gives an hour long complementary trial twice a month (both cannot be redeemed on the same day)
Once your hour is up, they block the mac address to your network card for 24hrs and deny your access. Changing the mac address manually proved to  be a very arduous task after my wife figured out I could get her on the internet (not tech savy, wont learn stuff)

This is an example of how one can use WMI functionality to get information for network adapters

Function getmacaddress() As String
Dim strComputer As String
Dim objWMIService, colItems, objitem
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
For Each objitem In colItems
If Not objitem.NetConnectionID = "null" Then
    If UCase(Trim(objitem.NetConnectionID)) = UCase(Trim("Wireless Network Connection")) Then
    On Error Resume Next
'    WScript.Echo "AdapterType: " & objitem.AdapterType
'    WScript.Echo "AutoSense: " & objitem.AutoSense
'    WScript.Echo "Availability: " & objitem.Availability
'    WScript.Echo "Caption: " & objItem.Caption
'    WScript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
'    WScript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
'    WScript.Echo "CreationClassName: " & objItem.CreationClassName
'    WScript.Echo "Description: " & objItem.Description
'    WScript.Echo "DeviceID: " & objItem.DeviceID
'    WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
'    WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
'    WScript.Echo "Index: " & objItem.Index
'    WScript.Echo "InstallDate: " & objItem.InstallDate
'    WScript.Echo "Installed: " & objItem.Installed
'    WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
'    WScript.Echo "Manufacturer: " & objItem.Manufacturer
'    WScript.Echo "MaxNumberControlled: " & objItem.MaxNumberControlled
'    WScript.Echo "MaxSpeed: " & objItem.MaxSpeed
'    WScript.Echo "NetworkAddresses: " & objItem.NetworkAddresses
'    WScript.Echo "PermanentAddress: " & objItem.PermanentAddress
'    WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
'    WScript.Echo "PowerManagementCapabilities: " & objItem.PowerManagementCapabilities
'    WScript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
'    WScript.Echo "ProductName: " & objItem.ProductName
'    WScript.Echo "ServiceName: " & objItem.ServiceName
'    WScript.Echo "Speed: " & objItem.Speed
'    WScript.Echo "Status: " & objItem.Status
'    WScript.Echo "StatusInfo: " & objItem.StatusInfo
'    WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
'    WScript.Echo "SystemName: " & objItem.SystemName
'    WScript.Echo "TimeOfLastReset: " & objItem.TimeOfLastReset
        If IsNull(objitem.MACAddress) = False Then
        getmacaddress = objitem.MACAddress
        End If
    End If
End If
Set objWMIService = Nothing
Set objitem = Nothing
End Function

From there one can easily edit the appropriate registry information to set a new mac address value (or other wireless network card details)

I was left with one issue after that, which was the computer needed to be restarted for the changes to take effect. And as we all know, shutting down your computer for one minor thing can be a severe pain in the ass.
BUT! I found on the web that using the device manager, we could disable and re-enable the wireless adapter and it will then use the new address you assigned.... so with more digging I found some example that would do the work for us via cmd line without involving device manager.

"wmic path win32_networkadapter where index=7 call enable"

I personally prefer to use a pipe to refer the information displayed back to my apps from cmd line calls, but a simple shell call would probably suffice as well.


Share this post

Link to post
Share on other sites
On 4/5/2017 at 10:59 PM, Jockey said:

real Wylde or...??

According to his handle , he should be. This was his old handle back in the days. 

This tool could help , as it does the same as You want to do.


It also updates list and so on , to match everything most up to date. :)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now