0

When trying to run getmac from the Windows Command Prompt, I am getting "ERROR: Invalid class". As a Windows utility, I'm not entirely sure why it's broken or how to go about fixing it.

Can anyone point me in the right direction?

----- EDIT -----

The point of this exercise it to be able to programmatically acccess a user's MAC address from a Node.js application. I originally ran into the issue with the getmac node module, which uses getmac under the hood. Thus I can't use Powershell or some other suggested solutions -- and I need this to be able to work offline.

arthurakay
  • 5,631
  • 8
  • 37
  • 62
  • Yes, `getmac` is a Windows utility: http://superuser.com/questions/66988/how-do-i-locate-the-mac-address-of-my-computer – arthurakay Jun 19 '15 at 15:18
  • Is this a virtual machine? Does `getmac /v /fo list` still error out? – paaschpa Jun 19 '15 at 15:43
  • Not a VM, an Acer PC running Windows 8.1 -- and yes, I get the same `Invalid class` error running that command – arthurakay Jun 19 '15 at 15:45
  • Is there a getmac.exe file in the `c:\Windows\System32` folder? – paaschpa Jun 19 '15 at 15:55
  • @paaschpa I get the impression it's there but something's disrupting access to the WMI information that (I'm guessing) `getmac` uses. – PhilPursglove Jun 19 '15 at 15:58
  • @arthurakay Do you need programmatic access to the MAC address, or do you just need to look it up for something e.g. licence registration? Could you use the C# code in [this answer](http://stackoverflow.com/a/7322670/1738) to get the MAC address? – PhilPursglove Jun 19 '15 at 16:01
  • @philpursglove I think you're right and would expect the 'not recognized as command' error if it wasn't, but just making sure. – paaschpa Jun 19 '15 at 16:02

1 Answers1

2

use ipconfig and use the physical address or in powershell use Get-NetAdapter

Dawesi
  • 568
  • 3
  • 9
  • 2
    I believe you would need to use `ipconfig /all` to include the 'Physical/Mac Address' with the resulting data. – paaschpa Jun 19 '15 at 16:03
  • `ipconfig /all` seems to give me what I need... when I'm offline, it does indeed still show me the physical address. Now I just need to parse that out :-) – arthurakay Jun 19 '15 at 17:25