1 
Get-CommandDefinitionHtmlnull2 function Get-CommandDefinitionHtml {
3 
4     # this tells powershell to allow advanced features,
5     # like the [validatenotnullorempty()] attribute below.
6     [CmdletBinding()]
7     param(
8         [ValidateNotNullOrEmpty()]
9         [string]$name
10     )
11 
12     $command = get-command $name
13 
14     # Look mom! I'm a cmdlet!
15     $PSCmdlet.WriteVerbose("Dumping HTML for " + $command)
16 
17 @"
18     <html>
19         <head>
20             <title>$($command.name)</title>
21         </head>
22         <body>
23             <table border="1">
24 $(
25     $command.parametersets | % {
26 @"
27 
28             <tr>
29                 <td>$($_.name)</td>
30                 <td>
31                     <table border="1">
32                         <tr>
33                             <th colspan="8">Parameters</th>
34 
35 $(
36         $count = 0
37         $_.parameters | % {
38             if (0 -eq ($count % 8)) {
39 @'
40                         </tr>
41                         <tr>
42 '@
43             }
44 @"
45                             <td>$($_.name)</td>
46 "@
47             $count++
48     }
49 )
50                         </tr>
51                     </table>
52                 </td>
53             </tr>
54 "@
55     }
56 )
57             </table>
58         </body>
59     </html>
60 "@
61 }
62 
63 Get-CommandDefinitionHtml get-item > out.html
64 
65 # show in browser
66 invoke-item out.html
67