I have a problem with my html output. My code with a loop that sequentially takes the IP address from the list and makes the following table. I need another tables from data of another switches.
My problem is that I do not know exactly how to repeat only the table + its title and then write and release it in one html file.
This is my HTML code for the table I'm calling the variable.
$Table = @"
<table
width: 912px;
border-collapse: collapse;
border-width: 2px;
border-style: solid;
border-color: grey;
font: 14pt Calibri;
color: black;
margin-bottom: 10px;
text-align: center;>
<h2>Switch 1</h2>
<div class=subtitle>
THIS is table from switch 1
</div>
<tbody>
<tr>
<th
height="18" width="90";
<td>
Adresa IP</span>
</td>
</th>
<th
height="18" width="90";
<td>
Počet portů</span>
</td>
</th>
<th
height="18" width="90";
<td>
Obsazené porty</span>
</td>
</th>
<th
height="18" width="90";
<td>
Volné porty</span>
</td>
</th>
<th
height="18" width="440";
<td>
Neaktivní porty</span>
</td>
</th>
</tr>
<tr>
<td
height="18" width="90";
border-bottom-width: 2px;
border-bottom-style: inset;">
<span
style="color: black;
font-family: Calibri;
font-size: 11pt; ">
$_</span>
</td>
<td
height="18" width="90";
border-bottom-width: 2px;
border-bottom-style: inset;">
<span
style="color:black;
font-family: Calibri;
font-size: 12pt; ">
$PocetPortu</span>
</td>
<td
height="18" width="90";
border-bottom-width: 2px;
border-bottom-style: inset;">
<span
style="color:black;
font-family: Calibri;
font-size: 11pt; ">
$OP
</span>
</td>
<td
height="18" width="90";
border-bottom-width: 2px;
border-bottom-style: inset;">
<span
style="color:black;
font-family: Calibri;
font-size: 11pt; ">
$PP</span>
</td>
<td
height="18" width="440";
border-bottom-width: 2px;
border-bottom-style: inset;">
<span
style="color:black;
font-family: Calibri;
font-size: 11pt; ">
$vypis</span>
</td>
</tbody>
</table>
"@
Only the one, the last table, always appears on the output page, and I have the HTML code captured in the loop where I get the values into the variables.
The command is called using:
$html | ConvertTo-Html -Head $Top_Head, $Style -Body $Table -PostContent $Post_text | Out-File C:\test\test.html
Invoke-Expression C:\test\test.html
Thank You.

Out-File -Appendwhat you need?