PowerShell Tip: Outputting Information to HTML

Using the ConvertTo-HTML command, you can push collected screen information to an HTML file in the file system.

Rod Trent

August 19, 2013

1 Min Read
PowerShell Tip: Outputting Information to HTML

Working within the PowerShell cmd window can be somewhat limiting, particularly if the command you entered contains lines and lines of return data. For example, running the Get-Service command on its own will retrieve and list all of the installed services on the computer. As shown in the following image, the displayed information scrolls the information off the screen.

Yes, you can use the scrollbar to review the retrieved data, but what if the information is 10, 20, or 50 scroll pages long?

Here's a quick tip.

Using the ConvertTo-HTML command, you can push collected information to an HTML file in the file system. This is useful, too, if you simply want to store the data to read later, or use as an archive for comparative processes.

Here's the format (still using the Get-Service example):

 Get-Service | ConvertTo-HTML > C:tempservices.htm 

Here's an example output:

 

 

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like