Blog Post

What’s my MAC Address in a Command Prompt?–#SQLNewBlogger

,

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

The other day I was working with a licensing issue and someone requested my MAC address to track something down. I know I could dig into the adapter properties, but that’s an annoying set of clicks in Windows. I decided to spend that time checking out how to get the MAC address from a command line.

Normal CMD

I tried “ipconfig” at the command line, which I always have open. I got my IP and DNS info, but no MAC. A quick search on Google showed me I needed more detail.

ipconfig /all

This gives me all the info, as you can see below:

2021-10-25 09_38_29-cmd - flyway info -url=_jdbc_sqlserver_____db=demo_db&user=_

PowerShell

I’d prefer PowerShell for many things like this, mostly because I could programmatically extract the values and use them elsewhere. I don’t need that here, but I might for something.

In this case, this is in the WMIObject, which is an ugly command. I’ll never remember this.

Get-WmiObject win32_networkadapterconfiguration | select description, macaddress

However, there’s an easier cmdlet.

Get-NetAdapter |select MacAddress, Name

This will return what I want. I get see which MAC is associated with which adapter.

2021-10-25 09_42_55-C__Users_Steve

Both quick ways to get some information.

SQLNewBlogger

I had to get some info, and I took a minute to learn something. This took me just 2-3 minutes to learn how to do this and practice. Then it was less than 10 minutes to do this post.

For reference, I used these links:

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating