Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

multiple wmi queries - export csv

$
0
0

Hello I am trying to query wmi data and export it to a csv, how ever I cant seem to get multiple wmi data to append to the same file. I don't know why you can't chain the command.

$computers = Get-Content -Path C:\machines.txt
$computers = $computers.Trim()

$test = Get-WmiObject win32_Bios -cn $computers | Select-Object Description,SerialNumber 

$test2 = Get-WmiObject Win32_Computersystem -cn $computers | Select-Object Domain,Manufacturer,Model,Name,NumberOfProcessors

$test2 | Export-CSV -Path "C:\Users\Public\outputfile.csv" -notypeinformation
$test | Export-CSV -Path "C:\Users\Public\outputfile.csv" -append -Force

Thank you for you help.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>