Mac address capture

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
superfly12
Posts: 133
Last visit: Sun Nov 02, 2014 4:37 pm

Mac address capture

Post by superfly12 »

Hi,
I am trying to capture MAC address and unable to capture just the mac address, it gives the following :
@{MacAddress=00:50:56:83:03:9X}
Have used these:
$nics_server = Get-WmiObject win32_networkadapterconfiguration | where {$_.ipEnabled -eq $True} | select MacAddress
Write-Host $nics_server
and
$nics_server = Get-WmiObject win32_networkadapter | where {$_.NetEnabled -eq $True} | select MacAddress
Write-Host $nics_server
how do i just capture "00:50:56:83:03:9X"?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Mac address capture

Post by jvierra »

Get-WmiObject win32_networkadapter -filter 'NetEnabled=True' |
ForEach-Object { $_.MacAddress }

Start by studying the basics of WMI then the basics of hwo to obtain values in PowerShell. Most of this kind of quesion will become obvious.
This topic is 11 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked