VMware Cloud Community
aryajp
Contributor
Contributor

PowerCLI script that helps to determine the Hardware address of vms which can be grabed from a input file

I'm looking for a PowerCLI script that helps to determine the Hardware address of vms which can be grabed from a input file. Please help.

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

Do you mean the MAC address with "hardware address"?

What can be grabbed from an input file? The VM names or the MAC addresses?

In what format is the input file? A CSV, a TXT... file?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
aryajp
Contributor
Contributor

MAC Address of network adaptors attached to vm like(00:50:56:80:9a:d3). vm names can be grabbed from input file which is a .txt file. 
Reply
0 Kudos
LucD
Leadership
Leadership

Try like this

$vmNames = Get-Content -Path .\vmnames.txt

Get-VM -Name $vmNames | Get-NetworkAdapter |

Select @{N = 'VM'; E = { $_.Parent.Name } }, MacAddress


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
aryajp
Contributor
Contributor

Thanks, it worked. 
Reply
0 Kudos