{"id":2152,"date":"2012-04-03T13:12:50","date_gmt":"2012-04-03T17:12:50","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2152"},"modified":"2012-04-03T13:12:50","modified_gmt":"2012-04-03T17:12:50","slug":"create-an-html-powershell-help-page","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/","title":{"rendered":"Create an HTML PowerShell Help Page"},"content":{"rendered":"<p>Yesterday I posted an <a href=\"http:\/\/jdhitsolutions.com\/blog\/2012\/04\/get-cmdlet-help-url\/\" title=\"read the article\" target=\"_blank\">article<\/a> about getting the online url for a cmdlet help topic. Today I want to demonstrate how we might take advantage of this piece of information.<\/p>\n<p>Since the link is already in the form of a URL, wouldn't it make sense to put this in an HTML document?  At first glance, you might take the command from yesterday and pipe it to ConvertTo-HTML.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\n Get-Command -CommandType cmdlet | Get-Help |<br \/>\n Select Name,Synopsis,@{Name=\"URI\";Expression={<br \/>\n ($_.RelatedLinks | select -ExpandProperty NavigationLink | where {$_.uri}).uri}} |<br \/>\n Where {$_.URI} | ConvertTo-HTML -Title \"Help Links\" | Out-File c:\\work\\pshelp.htm<br \/>\n<\/code><\/p>\n<p>This code will work just fine. But if you look at the resulting file, we don't have a link. I suppose it would be nice if ConvertTo-HTML could auto-detect URLs and automatically add a link, but it looks like we'll have to do it. We could probably use a custom hash table to insert the HTML Anchor tags so here's the first attempt:<\/p>\n<p><code lang=\"PowerShell\"><br \/>\nGet-Command -CommandType cmdlet | Get-Help | Where {$_.RelatedLinks} |<br \/>\nSelect Name,Synopsis,@{Name=\"URI\";Expression={<br \/>\n #add the link tags as part of the output!<br \/>\n $link=$_.RelatedLinks | select -ExpandProperty NavigationLink | where {$_.uri}<br \/>\n if ($link.uri) {<br \/>\n    $uri=$link.uri<br \/>\n    Write \"<a href='$uri' target='_blank'>$uri<\/a>\"<br \/>\n }<br \/>\n else {<br \/>\n    #no link so write a null<br \/>\n    write $Null<br \/>\n }<br \/>\n }} | Where {$_.URI} | ConvertTo-HTML -Title \"Help Links\" |<br \/>\n Out-File c:\\work\\pshelp.htm<br \/>\n<\/code><\/p>\n<p>One additional change I made was to filter out cmdlets with no related links. Then in the expression scriptblock I can create a new value based on the URI value if it exists. But there is a problem with this, which you'll see immediately if you run this code. ConvertTo-HTML sees the value of my new URI property and escapes the < and > characters.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1-300x177.png\" alt=\"\" title=\"cmdlethelp-1\" width=\"300\" height=\"177\" class=\"aligncenter size-medium wp-image-2153\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1-300x177.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1-1024x605.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1.png 1118w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>That doesn't help. But this is where the fact that ConvertTo-HTML only creates HTML code because we can parse the code and do a simple replace. Let me jump ahead and pull part of the finished dessert from the oven.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\nFunction Convert-HTMLEscape {<\/p>\n<p><#\nconvert &lt; and &gt; to < and ><br \/>\nIt is assumed that these will be in pairs<br \/>\n#><\/p>\n<p>[cmdletbinding()]<\/p>\n<p>Param (<br \/>\n[Parameter(Position=0,ValueFromPipeline=$True)]<br \/>\n[string[]]$Text<br \/>\n)<\/p>\n<p>Process {<br \/>\nforeach ($item in $text) {<br \/>\n    if ($item -match \"&lt;\") {<br \/>\n        <#\n          replace codes with actual symbols\n          This line is a shortcut to do two replacements\n          with one line of code. The code in the first\n          set of parentheses revised text with \"<\". This\n          normally gets written to the pipeline. By wrapping\n          it in parentheses it tells PowerShell to treat it\n          as an object so I can then call the Replace()\n          method again and add the >.<br \/>\n        #><br \/>\n        ($item.Replace(\"&lt;\",\"<\")).Replace(\"&gt;\",\">\")<br \/>\n     }<br \/>\n     else {<br \/>\n        #otherwise just write the line to the pipeline<br \/>\n        $item<br \/>\n     }<br \/>\n }<br \/>\n} #close process<\/p>\n<p>} #close function<br \/>\n<\/code><\/p>\n<p>This function takes string input, presumably from ConvertTo-HTML and replaces the HTML escapes with the \"real\" characters. This I can use to write to the file.<\/p>\n<p><code Lang=\"PowerShell\"><br \/>\n...| Where {$_.URI} | ConvertTo-HTML -Title \"Help Links\" |  Convert-HTMLEscape |  Out-File c:\\work\\pshelp.htm<br \/>\n<\/code><\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-2-300x177.png\" alt=\"\" title=\"cmdlethelp-2\" width=\"300\" height=\"177\" class=\"aligncenter size-medium wp-image-2154\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-2-300x177.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-2-1024x605.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-2.png 1118w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>One of the reasons I put this in a function is to make it re-usable for future projects where I might need to escape these characters again.  We're getting closer. One last thing before we ice the final dessert: I have been using an expression to get all cmdlet help. But I like flexibility. What if tomorrow I only want a page with New* cmdlets from PowerCLI? So once again, I took my code that works just fine from a prompt into a more flexible and re-usable function.<\/p>\n<p><code lang=\"PowerShell\"><\/p>\n<p>Function Get-HelpUri {<\/p>\n<p>[cmdletbinding()]<\/p>\n<p>Param(<br \/>\n[Parameter(Position=0,Mandatory=$True,HelpMessage=\"Enter a cmdlet name\",<br \/>\nValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]<br \/>\n[ValidateNotNullorEmpty()]<br \/>\n[string]$Name<br \/>\n)<\/p>\n<p>Process {<br \/>\n    Write-Verbose \"Processing $name\"<br \/>\n     Get-Help $name | Where {$_.RelatedLinks} |<br \/>\n    Select Name,Synopsis,@{Name=\"URI\";Expression={<br \/>\n     #add the link tags as part of the output!<br \/>\n     $link=$_.RelatedLinks | select -ExpandProperty NavigationLink | where {$_.uri}<br \/>\n     if ($link.uri) {<br \/>\n        $uri=$link.uri<br \/>\n        Write \"<a href='$uri' target='_blank'>$uri<\/a>\"<br \/>\n     }<br \/>\n     else {<br \/>\n        #no link so write a null<br \/>\n        write $Null<br \/>\n     }<br \/>\n     }}<br \/>\n} #close process<\/p>\n<p>} #close function<br \/>\n<\/code><\/p>\n<p>This will write a custom object with the cmdlet name, synopsis and URI property with the HTML code. I still need to convert to HTML and then fix the tags but I can verify it works.<\/p>\n<p><code lang=\"DOS\"><br \/>\nPS C:\\> get-command new-object | get-helpuri | ConvertTo-Html |Convert-HTMLEscape<br \/>\n<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\"  \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\n\"><br \/>\n<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><br \/>\n<head><br \/>\n<title>HTML TABLE<\/title><br \/>\n<\/head><body><\/p>\n<table>\n<colgroup>\n<col\/>\n<col\/>\n<col\/>\n<\/colgroup>\n<tr>\n<th>Name<\/th>\n<th>Synopsis<\/th>\n<th>URI<\/th>\n<\/tr>\n<tr>\n<td>New-Object<\/td>\n<td>Creates an instance of a Microsoft .NET Framework or COM object.<\/td>\n<td><a href=\n'http:\/\/go.microsoft.com\/fwlink\/?LinkID=113355' target='_blank'>http:\/\/go.microsoft.com\/fwlink\/?LinkID=11335<br \/>\n5<\/a><\/td>\n<\/tr>\n<\/table>\n<p><\/body><\/html><br \/>\n<\/code><\/p>\n<p>The icing is to include some style via a CSS file. Here's a short script on how I might build a file for all of the cmdlets in my current session.<\/p>\n<p><code Lang=\"PowerShell\"><br \/>\nWrite-Host \"Building cmdlet help report\" -ForegroundColor Green<\/p>\n<p>#the file to create<br \/>\n$file=\"c:\\work\\cmdletonline.htm\"<\/p>\n<p>#be sure to change the path to the CSS file if you want to use it<br \/>\n$cssPath=\"c:\\scripts\\blue.css\"<\/p>\n<p>#optional image<br \/>\n$imagePath=\"c:\\work\\talkbubble.gif\"<\/p>\n<p>#some pre content<br \/>\n$preContent=@\"<br \/>\n<H1><br \/>\n<img src='$imagePath' align='middle' align='left' width='96' heigth='96'\/><br \/>\nCmdlet Online Help<br \/>\n<\/H1><br \/>\n<HR\/><br \/>\n\"@<\/p>\n<p>#some post content<br \/>\n$postContent=@\"<br \/>\n<br \/>\n<I>Help for cmdlets found on $env:computername on $(Get-Date)<\/I><br \/>\n\"@<\/p>\n<p>#a title for the report<br \/>\n$Title=\"Cmdlet Help\"<\/p>\n<p><#\n  Get all cmdlets in the current session, send them to the Get-HelpURI\n  function to parse out help URLS, filter out those without a link, pass\n  the remaining to the Convertto-HTML to generate HTML code which is piped\n  to my function to replace &lt; with > and the final HTML code is piped to<br \/>\n  a file.<br \/>\n#><br \/>\nGet-Command -CommandType cmdlet | Get-HelpURI  | Where {$_.URI} |<br \/>\nConvertTo-Html -PreContent $PreContent -PostContent $postContent -Title $Title -cssUri $cssPath |<br \/>\nConvert-HTMLEscape | Out-File -FilePath $file -Encoding ASCII<\/p>\n<p> Write-Host \"Finished. See $file for the results\" -ForegroundColor Green<br \/>\n<\/code><\/p>\n<p>And here's the final result in Internet Explorer.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-3-300x191.png\" alt=\"\" title=\"cmdlethelp-3\" width=\"300\" height=\"191\" class=\"aligncenter size-medium wp-image-2157\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-3-300x191.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-3-1024x653.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-3.png 1141w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Ok, maybe you don't have a compelling need for this exact script, but I hope you picked up on the importance of writing code for re-use and taking advantage of the pipeline.<\/p>\n<p>If you'd like to try my code out for yourself, including the graphic and CSS file, download this <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/Get-HelpUri.zip'>zip file<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday I posted an article about getting the online url for a cmdlet help topic. Today I want to demonstrate how we might take advantage of this piece of information. Since the link is already in the form of a URL, wouldn&#8217;t it make sense to put this in an HTML document? At first glance,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8],"tags":[28,229,224,78,367,76,237,534],"class_list":["post-2152","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-cmdlet","tag-convertto-html","tag-function","tag-get-command","tag-get-help","tag-help","tag-html","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create an HTML PowerShell Help Page &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create an HTML PowerShell Help Page &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Yesterday I posted an article about getting the online url for a cmdlet help topic. Today I want to demonstrate how we might take advantage of this piece of information. Since the link is already in the form of a URL, wouldn&#039;t it make sense to put this in an HTML document? At first glance,...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2012-04-03T17:12:50+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1-300x177.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Create an HTML PowerShell Help Page\",\"datePublished\":\"2012-04-03T17:12:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/\"},\"wordCount\":491,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/cmdlethelp-1-300x177.png\",\"keywords\":[\"cmdlet\",\"ConvertTo-HTML\",\"Function\",\"Get-Command\",\"Get-Help\",\"Help\",\"HTML\",\"PowerShell\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/\",\"name\":\"Create an HTML PowerShell Help Page &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/cmdlethelp-1-300x177.png\",\"datePublished\":\"2012-04-03T17:12:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/cmdlethelp-1.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/cmdlethelp-1.png\",\"width\":\"1118\",\"height\":\"661\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2152\\\/create-an-html-powershell-help-page\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create an HTML PowerShell Help Page\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create an HTML PowerShell Help Page &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/","og_locale":"en_US","og_type":"article","og_title":"Create an HTML PowerShell Help Page &#8226; The Lonely Administrator","og_description":"Yesterday I posted an article about getting the online url for a cmdlet help topic. Today I want to demonstrate how we might take advantage of this piece of information. Since the link is already in the form of a URL, wouldn't it make sense to put this in an HTML document? At first glance,...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/","og_site_name":"The Lonely Administrator","article_published_time":"2012-04-03T17:12:50+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1-300x177.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Create an HTML PowerShell Help Page","datePublished":"2012-04-03T17:12:50+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/"},"wordCount":491,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1-300x177.png","keywords":["cmdlet","ConvertTo-HTML","Function","Get-Command","Get-Help","Help","HTML","PowerShell"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/","name":"Create an HTML PowerShell Help Page &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1-300x177.png","datePublished":"2012-04-03T17:12:50+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/cmdlethelp-1.png","width":"1118","height":"661"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2152\/create-an-html-powershell-help-page\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Create an HTML PowerShell Help Page"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1384,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1384\/create-a-master-powershell-online-help-page\/","url_meta":{"origin":2152,"position":0},"title":"Create a Master PowerShell Online Help Page","author":"Jeffery Hicks","date":"April 28, 2011","format":false,"excerpt":"As I hope you know, PowerShell cmdlets can include links to online help. This is very handy because it is much easier to keep online help up to date. To see online help for a cmdlet use the -online parameter. get-help get-wmiobject -online I decided to take things to another\u2026","rel":"","context":"In &quot;Miscellaneous&quot;","block_context":{"text":"Miscellaneous","link":"https:\/\/jdhitsolutions.com\/blog\/category\/miscellaneous\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":889,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/889\/get-some-style\/","url_meta":{"origin":2152,"position":1},"title":"Get Some Style","author":"Jeffery Hicks","date":"August 31, 2010","format":false,"excerpt":"Windows PowerShell has many ways to present and store information. You can display it to the screen, write it to a file, send it to a printer, create an CSV or XML file or even a pretty HTML report. The ConvertTo-HTML cmdlet underwent a significant facelift for v2.0 and is\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3966,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3966\/friday-fun-text-to-html\/","url_meta":{"origin":2152,"position":2},"title":"Friday Fun Text to HTML","author":"Jeffery Hicks","date":"August 22, 2014","format":false,"excerpt":"I love being able to create HTML documents from PowerShell commands. The Convertto-HTML cmdlet will happily turn any object into an HTML table using whatever properties you specify. Plus you can do all sorts of fancy things such as embedding a style sheet in the header, creating HTML fragments and\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"html","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/08\/html-150x150.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":7163,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7163\/creating-linked-html-with-powershell\/","url_meta":{"origin":2152,"position":3},"title":"Creating Linked HTML with PowerShell","author":"Jeffery Hicks","date":"January 13, 2020","format":false,"excerpt":"Today's post is about a niche problem or something that maybe you never considered before. And while I will share a finished PowerShell function, you may want to create your own tooling based on the techniques and concepts. The problem begins with a command like this: Get-HotFix -ComputerName $env:computername |\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/d_thumb.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/d_thumb.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/d_thumb.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/01\/d_thumb.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1923,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1923\/send-powershell-reports-by-mail\/","url_meta":{"origin":2152,"position":4},"title":"Send PowerShell Reports by Mail","author":"Jeffery Hicks","date":"December 29, 2011","format":false,"excerpt":"Today I came across a post about pinging a list of computers and send the results as a table via Outlook. Brian is a very smart Active Directory guy so I offered some PowerShell suggestions to make his task even easier. Obviously you can only offer so much in a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/html-mail-300x192.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6065,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6065\/converting-powershell-to-markdown\/","url_meta":{"origin":2152,"position":5},"title":"Converting PowerShell to Markdown","author":"Jeffery Hicks","date":"August 15, 2018","format":false,"excerpt":"I have been working a lot with markdown documents over the last year or so, primarily due to all the books I've been working on published at Leanpub.com. With the growing use of markdown in projects like Platyps for generating help files and documentation, you will most likely be using\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/08\/image_thumb-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/08\/image_thumb-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/08\/image_thumb-2.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2152"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2152\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}