
- #How to find mac model identifier serial number#
- #How to find mac model identifier code#
- #How to find mac model identifier windows#
Variant instances = wmi.invoke("InstancesOf", "Win32_BaseBoard") Įnumeration en = new EnumVariant(instances.getDispatch()) ĪctiveXComponent bb = new ActiveXComponent(en.nextElement().getDispatch()) Import ĪctiveXComponent wmi = new ActiveXComponent("winmgmts:\\\\.")
#How to find mac model identifier windows#
On Windows only, you can get the motherboard ID using WMI, through a COM bridge such as JACOB.

#How to find mac model identifier serial number#
Your output will be different since at least the processor serial number will differ. Output for my machine: Microsoft#57YRD12#Intel64 Family 6 Model 60 Stepping 3#8 String identifier = generateLicenseKey() Public static void main(String arguments)

Int processors = centralProcessor.getLogicalProcessorCount() String processorIdentifier = centralProcessor.getIdentifier() String processorSerialNumber = computerSystem.getSerialNumber() String vendor = operatingSystem.getManufacturer() HardwareAbstractionLayer hardwareAbstractionLayer = systemInfo.getHardware() ĬentralProcessor centralProcessor = hardwareAbstractionLayer.getProcessor() ĬomputerSystem computerSystem = hardwareAbstractionLayer.getComputerSystem() OperatingSystem operatingSystem = systemInfo.getOperatingSystem() SystemInfo systemInfo = new SystemInfo()
#How to find mac model identifier code#
The OSHI project provides platform-independent hardware utilities.įor instance, you could use something like the following code to identify a machine uniquely: import oshi.SystemInfo Java code to get computer SN on Windows.$/generated-sources/com4jĪbove's configuration will tell plugin to generate classes in target/generated-sources/com4j directory in the project folder.įor those who would like to see ready-to-use solution, I'm including links to the three classes I wrote to get machine SN on Windows, Linux and Mac OS: Example configuration for maven-com4j-plugin: Please note that all classes required by this example has to be generated by maven-com4j-plugin. This will print some computer information together with computer Serial Number. ISWbemObject wo = obj.queryInterface(ISWbemObject.class) ISWbemObjectSet result = wbemServices.execQuery("Select * from Win32_SystemEnclosure","WQL",16,null) ISWbemServices wbemServices = nnectServer("localhost","Root\\CIMv2","","","","",0,null)

(ni.getName() + " " + ni.getDisplayName()) įrom the options listen on this page, the most acceptable for me, and the one I've used in my solution is the one by Duz, the other one, similar to answer where he used JACOB, and worth mentioning is com4j - sample which makes use of WMI is available here: ISWbemLocator wbemLocator = ClassFactory.createSWbemLocator() With such condition MAC stored when laptop was connected through cable will now be invalid.įor example those are adapters I found in my system: lo MS TCP Loopback interfaceĮth0 Intel(R) Centrino(R) Advanced-N 6205Įth1 Intel(R) 82579LM Gigabit Network ConnectionĮth2 VirtualBox Host-Only Ethernet AdapterĮth3 Sterownik serwera dostepu do sieci LAN BluetoothĬode I've used to list them: Enumeration nis = NetworkInterface.getNetworkInterfaces() If one would decide to use adapter which is currently in use (has addresses assigned) then new problem appears since someone can take his/her laptop and switch from cable adapter to wi-fi. I tested MAC solution on my system, but I have 4 adapters (cable, WiFi, TAP adapter for Virtual Box and one for Bluetooth) and I was not able to decide which MAC I should take. In such situation one would have to know which adapter's MAC address should be used. Most of the newest ones have two by default (wi-fi + cable). The problem with MAC address is that there can be many network adapters connected to the computer.
