PowerShell tips to get MAC address _powershell

Source: Internet
Author: User

It is not difficult to get a MAC address in PowerShell. Here's a way:

Copy Code code as follows:

ps> GETMAC/FO CSV | Convertfrom-csv

Physical Address transport Name
----------------                        --------------
5c-51-4f-62-f2-7d \device\tcpip_{ff034a81-cbfe-4b11-9d ...
5c-51-4f-62-f2-81 Media Disconnected

The problem we face is to classify data and format it. The unhandled information is from the Getmac.exe output of CSV data, here's a tip: Skip the first line to name your favorite columns (with a CSV header at this point), and you can provide your own unique letterhead:

Copy Code code as follows:

GETMAC.EXE/FO CSV |
Select-object-skip 1 |
Convertfrom-csv-header MAC, Transport

The above will produce a custom letterhead "MAC" and "Transport".

The same is true of object-oriented methods, such as calling special commands in WMI or WIN8.1, or server 2012/2012r2. Anyway, we're explaining an interesting approach that also shows how to translate CSV data into meaningful information.

Supports all PS versions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.