Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » ConvertTo-Html

ConvertTo-Html - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

ConvertTo-Html

Description
Convert the input into an HTML table

Usage


Options


Example(s)
Display the date as HTML on the console :

PS C:\>get-date | convertto-html

Save the system processes to C:\processes.html

PS C:\>Get-Process | ConvertTo-Html name,path,fileversion | Set-Content c:\processes.htm

Save the system services to C:\services.html

PS C:\>get-service | ConvertTo-Html -Title "Services" -Body "<H2>The result of get-service</H2> " -Property Name,Status  >  c:\services.html

Save the system services to C:\services.html and format in color:

PS C:\>get-service | ConvertTo-Html -Title "Services" -Body "<H2>The result of get-service</H2> " -Property Name,Status |
foreach {if($_ -like "*<td>Running</td>*"){$_ -replace "<tr>", "<tr bgcolor=green>"}elseif($_ -like "*<td>Stopped</td>*"){$_ -replace "<tr>", "<tr bgcolor=red>"}else{$_}}   >  c:\services.html