Scroll Top
Evotec Services sp. z o.o., ul. Drozdów 6, Mikołów, 43-190, Poland

Out-HtmlView – HTML alternative to Out-GridView

Out-HtmlView

One of the most comfortable output's in PowerShell to work and analyze data is Out-GridView. It's handy as you can search, sort and have things done quicker than trying to do things in the console. However it's currently not available in PowerShell Core (PowerShell 6+), and when it is available in PowerShell 7, it will NOT be cross-platform.  Since I had released Dashimo a few days ago, I thought it was trivial to make a simple command out of it that could solve this problem.

Out-HtmlView

PowerShell Out-HtmlView - In action on MacOS

Actually, it brings a couple of other features into the mix. It adds export to CSV, export to Excel and export to PDF at the same time. Here's Out-HtmlView in action on MacOS.

Out-HtmlView

Easy to use, sorting, search, export, and very fast. Keep in mind that Safari by default has blocked running of JavaScript for local files. To use this function you need to enable Developer tools in Preferences, and then under menu Develop, you can select “Disable Local File Restrictions” there. Chrome doesn't have those limits on MacOS so should work straight away.

PowerShell Out-HtmlView - In action on Windows

Out-HtmlView-Windows

And here's a little demo on Windows 10. It works in Powershell 5.1 and higher. I've not tested on lower versions, but since I never paid attention to compatibility, I doubt it will work.

Installation and usage

Out-HtmlView is part of  PSWriteHTML module. Please keep in mind that if you used it before you need to use FORCE parameter to make sure it updates any other required modules.

Install-Module PSWriteHTML -Force

Usage is as easy as it gets

Get-Process | Select-Object -First 100 |Out-HtmlView
Get-Process | Select-Object -First 5 |Out-HtmlView

# Keep in mind that Get-Process holds a lot of data so displaying all rows will take a minute to generate
Get-Process | Out-HtmlView
Get-ChildItem | Out-HtmlView

PS. I've created an alias for Out-HtmlView to Out-GridHtml so that it can be easier for people having a habit typing Out-GridView on MacOs or Linux.

Posty powiązane