Formatting data from multiple jobs

This topic contains 1 reply, has 2 voices, and was last updated by  Dave Wyatt 3 years, 1 month ago.

  • Author
  • #20826

    Nathaniel Toney

    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.

  • #20828

    Dave Wyatt

    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 $_

You must be logged in to reply to this topic.