PowerShell Tip: Outputting Information to HTML

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:\temp\services.htm

Here's an example output:



Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.