Avatar of Lofty Worm
Lofty Worm
Flag for United States of America

asked on 

Powershell to return multiple csv/html files

With the script I Have, it runs a simple loop and returns some values, but they are all returned in one csv or html file.  How can I tell PS to return each iteration in a separate file?

Command to run the file I am using is
Get-ComputerInfo.ps1 | export-csv outputfile.csv
Get-ComputerInfo.ps1 | ConvertTo-Html | out-file bleh.html
$list = Get-Content "server_list.txt"
foreach($server in $list)
    $CompInfo = Get-WmiObject Win32_ComputerSystem -comp $Server
    $myobj | Add-Member -MemberType NoteProperty -Name "Caption" -Value CompInfo.Caption

Open in new window

Scripting LanguagesPowershell

Avatar of undefined
Last Comment

8/22/2022 - Mon