Sunday, March 23, 2014

List content of a model to HTML using PowerShell

Building on this post on listing elements in a model and this post on putting a list in a HTML file I wanted to quickly just show an easy and quick way to create list elements in a model to HTML. The PowerShell command is easy, and the results are swift and usable.

For this example I'm going to list the contents of a hotfix.

(axmodel -model 'Hotfix-KB2909140-Foundation' -details).elements | select name, elementtype, path | `
sort path | ConvertTo-Html -CssUri | Out-File c:\KB2909140.html

The HTML-file can be viewed using your favorite browser.

Nifty, ey? :-)