Import csv file to get-network adapter of multiple vms

Using below script

Get-network adapter -vm (Then i list about 60 vms)

I then pipe it to a csv document, is there a handy way to pipe it in the first place from a csv?

Thanks,
LVL 1
Indie101Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

footechCommented:
You mean like this? (assumes .CSV with a header named "computer")
Import-CSV file.csv | ForEach { Get-network adapter -vm $_.computer }

Open in new window

You can pipe from that into Export-CSV, or use Select-Object to choose specific properties, etc.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FOXActive Directory/Exchange EngineerCommented:
As footech mentioned have a header of computer or vmname and run the below with the file location of your .csv file.
In my example we will assume the header is vmname and the .csv file  is in the temp folder of the c: drive

Import-Csv 'c:\temp\machines.csv' | %{Get-NetworkAdapter -VM $_.vmname | Select MacAddress,Id,Name} | Export-csv 'c:\temp\results.csv' -notypeinformation
1
Indie101Author Commented:
Admin...Can i amend this to give fox 150 points and the rest to footech please?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.