Author Posts

November 26, 2014 at 2:17 am

Hi guys,

Quick question.

If I'm running jobs that return an array of MAC addresses, how would I add a column of hostnames from a text file that it's getting content from to match the MACs?

Can't seem to figure this one out. If you need a sample of my script I'll add it soon, going to lunch right now.

Thanks for your help.

November 26, 2014 at 5:02 am

What's in your text file now, hostnames or MAC addresses? If you're reading one and looking up the other, then you just need to build an object that has both properties. Something along these lines (assuming a fake function called Get-MacAddress is doing the work of turning a hostname into a MAC):

Get-Content hostnames.txt |
ForEach-Object {
    New-Object psobject -Property @{
        ComputerName = $_
        MacAddress = Get-MacAddress -ComputerName $_