Hallo zusammen
Folgendes Problem:
Ich lese mittels Powershell einige Daten aus Servern aus. Darunter etwa Processe, Services, Arbeitsspeicher, etc.
Diese Ausgaben werden in eine .csv-Datei gespeichert.
Nun möchte ich, dass ich alle diese .csv-Dateien in eine einzige HTML-Datei schreiben/konvertieren kann.
Mit einer .csv-Datei funktioniert das auch prima, aber bei mehreren scheitere ich irgendwie ...
Folgendes hab ich bereits geschrieben:
function checkSysHTML { if (checkFiles) { $htmlformat = '<title>SystemCheckUp</title>' $htmlformat += '<style type="text/css">' $htmlformat += 'BODY{background-color:white;color:#003399;font-family:Arial Narrow,sans-serif;font-size:20px;}' $htmlformat += 'TABLE{border-width: 3px;border-style: solid;border-color: black;border-collapse: collapse;}' $htmlformat += 'TH{border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color:#white}' $htmlformat += 'TD{border-width: 1px;padding: 8px;border-style: solid;border-color: black;background-color:#white}' $htmlformat += '</style>' Import-Csv -Path $pathprocess -delimiter ';' | ConvertTo-Html -Head $htmlformat -Body '<h1>Process</h1>' | Out-File .\SysCheckUp.html Invoke-Expression .\SysCheckUp.html } else { Write-Host 'CSV-Files not found, returning to main menu' } }
* checkFiles ist eine Funktion, die die benötigten csv-Files überprüft.
csv-Files sind bereits vorhanden
CSV-Format Bsp. Process:
"Name";"CPU-Time";"Workingsites(MB)"
"cdb";"126.22";"27.98"
"cmd";"0.00";"2.85"
Datum / Uhrzeit
19.12.2013 15:18
Bisher ausgegebene HTML-Datei:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>SystemCheckUp</title><style type="text/css">BODY{background-color:white;color:#003399;font-family:Arial Narrow,sans-serif;font-size:20px;}TABLE{border-width: 3px;border-style: solid;border-color: black;border-collapse: collapse;}TH{border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color:#white}TD{border-width: 1px;padding: 8px;border-style: solid;border-color: black;background-color:#white}</style></head><body><h1>Process</h1><table><colgroup><col/><col/><col/></colgroup><tr><th>Name</th><th>CPU-Time</th><th>Workingsites(MB)</th></tr><tr><td>cdb</td><td>126.22</td><td>27.98</td></tr><tr><td>cmd</td><td>0.00</td><td>2.85</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Datum / Uhrzeit</td><td></td><td></td></tr><tr><td>19.12.2013 15:18</td><td></td><td></td></tr></table></body></html>
Gruss Syside