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:

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.

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

  1. Raffael says:

    Hi Steve, the MAC address shows in ipconfig, it’s just called Physical Address, but I agree, PowerShell is the way to go!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.