Example Code

Retrieve specific MAC address using Windows getmac

Code and Documents

Attachment

Overview

I needed a better way of reliably obtaining a specific MAC address from a Windows PC using LV than the available utility found at http://digital.ni.com/public.nsf/allkb/73AFD39FFBAAED6B8625753D00258A90

Use case: registering deployed assets via their MAC addresses.

Description

This utility uses getmac (built-in command in Windows 7 and up, which will return data as csv string) to retrieve all NICs on the local machine. Could be modified to target remote machine. Options to filter out "-"s from the returned MAC addresses, return only connected adaptors (filters out "Media disconected" and "Hardware not present") and search for a specifically named adaptor (such as "Local Area Connection") or return all adaptors with the string in the name. Outputs include All hardware, connected hardware, name-filtered and the first filtered and validated MAC address found in the filtered list.


Requirements

Software

Labview Runtime 2014 (Might work on older versions)

Window 7, and up



Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors