Question

I'm trying to put some basic level of protection to an Excel (for Windows) application I'm writing. I was thinking on generating a license file using the machine's mac address. My question is: how can I get the Mac Address using VBScript?

Était-ce utile?

La solution

dim WMI:  set WMI = GetObject("winmgmts:\\.\root\cimv2")
dim Nads: set Nads = WMI.ExecQuery("Select * from Win32_NetworkAdapter where physicaladapter=true") 
dim nad
for each Nad in Nads
    if not isnull(Nad.MACAddress) then Wscript.Echo Nad.description, Nad.MACAddress   
next 

However MAC can be a poor choice; What's a good way to uniquely identify a computer?.

This will return all physical adapters, but for me I also see my Cisco Systems VPN Adapter for 64-bit Windows which I would not describe as physical.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top