I am having a hard time creating a table that has multiple columns. The columns will be populated using various cmdlets. At the very end of a script, I want to run a final check and write the hostname to a file, along with various other columns. Here is what I was thinking for the headings: "HOSTNAME", "FILES REPLACED?", "SCCM UNINSTALLED?" The rows below these headings will show computer name, TRUE or FALSE, and TRUE or FALSE. So far, I am able to export the data to an HTM file, but it does not show up in separate columns. This is what I have:
$hostname | ConvertTo-Html -Property @{Expression={ $hostname};Label="Hostname"} |
Out-File C:\Temp\Test.htm -Append -NoClobber
If (Test-Path -Path $FileCheck) {
Test-path -Path $FileCheck | ConvertTo-Html -Property @{Expression=`
{ [string]"TRUE"};Label="Windows files replace"} | Out-File C:\Temp\Test.htm `
-Append -NoClobber
}
Else {
Test-path -Path $FileCheck | ConvertTo-Html -Property @{Expression=`
{ [string]"FALSE"};Label="Windows files replaced"} | Out-File C:\Temp\Test.htm `
-Append -NoClobber
}
I basically just need to understand how to create a table or array with 3 or 4 columns and how to populate the rows for those columns. Each computer will have a different row and show something like (COMPUTER1,TRUE,FALSE,TRUE). The way I currently have it set up, it is creating new rows when I need the headings in new columns.