문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top