Powershell/Exemples/etape1.ps1
2023-07-04 12:59:44 +02:00

178 lines
3.2 KiB
PowerShell

#Creation de la page HTML
$hostname = "Serveur 1";
$date = Date;
[System.Collections.ArrayList] $lignes = @()
$lignes += 'Installation ServerView RAID;OK/KO'
$lignes += 'Installation MegaRAID;OK/KO'
$lignes += 'Installation AD-Domain-Services;OK/KO'
$lignes += 'Installation DHCP;OK/KO'
$lignes += 'Installation Hyper-V;OK/KO'
$lignes += 'Installation SNMP;OK/KO'
$VersionWindows = "Windows Server 2016"
$NumeroDeSerie = "QSXRTFYJ5YIFL48"
$CPU = "Celeron 2 Duo"
$RAM = "256MB"
$NombreDeDisque = "1"
$EtatDisque = "OK"
$EtatRaid = "OK"
$HTML = @"
<HTML>
<style>
body{
font-family: Arial;
background-color: #FFFFFF;
text-align: center;
margin: 2% 2% 2% 2%;
}
h1{
background-color: #3074d3;
color: white;
}
tr{
background-color: #EFEFEF;
}
#hostname{
width: 100%;
font-size: 350%;
text-align: center;
}
</style>
<body>
<div id='hostname'>$hostname</div>
<h3>$date</h3>
<table width='49%' style='display: inline-block; float: left;'>
<tr>
<td height="42px" width='100%'>Version de Windows</td>
<td height="42px" width='100%'>$VersionWindows</td>
</tr>
<tr>
<td height="42px" width='100%'>Date</td>
<td height="42px" width='100%'>$date</td>
</tr>
<tr>
<td height="42px" width='100%'>Numéro de série</td>
<td height="42px" width='100%'>$NumeroDeSerie</td>
</tr>
<tr>
<td height="42px" width='100%'>Processeur</td>
<td height="42px" width='100%'>$CPU</td>
</tr>
<tr>
<td height="42px" width='100%'>RAM</td>
<td height="42px" width='100%'>$RAM</td>
</tr>
<tr>
<td height="42px" width='100%'>Nombre de disque</td>
<td height="42px" width='100%'>$NombreDeDisque</td>
</tr>
<tr>
<td height="42px" width='100%'>Etat disque</td>
<td height="42px" width='100%'>$EtatDisque</td>
</tr>
<tr>
<td height="42px" width='100%'>Etat Raid</td>
<td height="42px" width='100%'>$EtatRaid</td>
</tr>
</table>
<table width='49%' style='display: inline-block; margin-left: 1%; '>
<tr height='86px'>
<td width='100%'>Disque C</td>
<td width='100%'></td>
</tr>
<tr height='86px'>
<td width='100%'>Disque D</td>
<td width='100%'></td>
</tr>
<tr height='86px'>
<td width='100%'>Disque E</td>
<td width='100%'></td>
</tr>
<tr height='86px'>
<td width='100%'>Disque F</td>
<td width='100%'></td>
</tr>
</table>
<br><br><br><br>
"@
$table = @"
<h1 width='100%'> ETAPE 1 </h1>
<table id='etape1' width='100%' >
<th></th>
<th>Status </th>
"@
ForEach($elem in $lignes){
$ligne = $elem.Split(';')
$ligne0=$ligne[0]
$ligne1=$ligne[1]
$table += @"
<tr>
<td width='85%'>$ligne0</td>
<td width='15%'>$ligne1</td>
</tr>
"@
}
$table += '</table>'
$HTML += $table
$HTML | Out-file "C:\Users\arobert\Desktop\Powershell etapes en HTML\index1.html"