WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: pamsniffer on October 21, 2015, 12:44:19 PM

Title: change and read MAC adress
Post by: pamsniffer on October 21, 2015, 12:44:19 PM
Hi,

I can read an mac adress but is there also a way to change it.

for reading
strComputer = "."
objWMIService = GetObject(StrCat("winmgmts:!\\" , strComputer , "\root\cimv2"))
colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True AND DHCPEnabled = True")
ForEach objAdapter in colAdapters
   Message( "Physical address: " , objAdapter.MACAddress )

How can I change an MAC adress.

PAM
Title: Re: change and read MAC adress
Post by: td on October 21, 2015, 01:29:00 PM
Obviously, you can't change a NIC's MAC address as  it is permanently assigned by the manufacturer.  It can be spoofed, however.  One programmatic way to doing this (other than UI automation)  is to change the registry and then renew the IP configuration.   A Web search should turn up some examples.  Here is but one link:

http://www.wikihow.com/Change-a-Computer's-Mac-Address-in-Windows