{"id":1292,"date":"2011-03-29T09:44:33","date_gmt":"2011-03-29T13:44:33","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1292"},"modified":"2011-03-29T09:44:33","modified_gmt":"2011-03-29T13:44:33","slug":"new-comment-help","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/","title":{"rendered":"New Comment Help"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.png\" alt=\"\" title=\"helpbubble\" width=\"180\" height=\"180\" class=\"alignleft size-full wp-image-1294\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.png 180w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble-150x150.png 150w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a>If you follow my blog I'm sure you noticed that I post a lot of advanced functions and scripts. While I don't expect every one to be developing advanced functions, the closer you can get the more powerful your work. With the Scripting Games approaching I thought I'd offer up a little something to help take your scripts to the next level and that is adding comment based help.  This is a specially structured comment block that you can insert into your functions and scripts. The comment block is parsed by Get-Help to produce the same type of help output you see with cmdlets. But creating the help comment can be tricky so I wrote a script based wizard.<!--more--><\/p>\n<p>My function, New-CommentHelp,  prompts for all the necessary information and constructs an appropriate comment help block.  Here's the function and then I'll go through a few key points.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nFunction New-CommentHelp {<\/p>\n<p>Param()<\/p>\n<p>#define beginning of comment based string<\/p>\n<p>$comment=@\"<br \/>\n<#\n.SYNOPSIS\n{0}\n.DESCRIPTION\n{1}\n\n\"@\n\n#prompt for command name (default to script name)\n$name=Read-Host \"What is the name of your function or command?\"\n\n#prompt for synopsis\n$Synopsis=Read-Host \"Enter a synopsis\"\n#prompt for description\n$description=Read-Host \"Enter a description. You can expand and edit later\"\n\n#Create comment based help string\n$help=$comment -f $synopsis,$description\n\n#test if command is loaded and if so get parameters\n#ignore common: \n$common=\"VERBOSE|DEBUG|ERRORACTION|WARNINGACTION|ERRORVARIABLE|WARNINGVARIABLE|OUTVARIABLE|OUTBUFFER\"\nTry \n{\n    $command=get-command -Name $name -ErrorAction Stop\n    $params=$command.parameters.keys | where {$_ -notmatch $common} \n}\nCatch\n{\n    #otherwise prompt\n    $scriptname=Read-Host \"If your command is a script file, enter the full file name with extension. Otherwise leave blank\"\n    if ($scriptname)\n    {\n        Try \n        {\n            $command=get-command -Name $scriptname -ErrorAction Stop\n            $params=$command.parameters.keys | where {$_ -notmatch $common} \n        }\n        Catch\n        {\n            Write-Warning \"Failed to find $scriptname\"\n            Return \n        }\n\n    } #if $scriptname\n    else\n    {\n        #prompt for a comma separated list of parameter names\n        $EnterParams=Read-Host \"Enter a comma separated list of parameter names\"\n        $Params=$EnterParams.Split(\",\")\n    }\n}\n\n#get parameters from help or prompt for comma separated list\n Foreach ($param in $params) {\n    #prompt for a description for each parameter\n    $paramDesc=Read-host \"Enter a short description for parameter $($Param.ToUpper())\"\n    #define a new line\n#this must be left justified to avoid a parsing error\n$paramHelp=@\"\n.PARAMETER $Param\n$paramDesc\n\n\"@\n       \n        \n    #append the parameter to the help comment\n    $help+=$paramHelp\n    } #foreach\n    \nDo\n{\n    #prompt for an example command\n    $example=Read-Host \"Enter an example command. You do not need to include a prompt. Leave blank to continue\"\n    if ($example)\n    {\n    \n    #prompt for an example description\n    $exampleDesc=Read-Host \"Enter a brief description of this example\"\n    \n#this must be left justified to avoid a parsing error    \n$exHelp=@\"\n.EXAMPLE\nPS C:\\> $example<br \/>\n$exampleDesc<\/p>\n<p>\"@    <\/p>\n<p>    #add the example to the help comment<br \/>\n    $help+=$exHelp<br \/>\n    } #if $example<\/p>\n<p>} While ($example)<\/p>\n<p>#Prompt for version #<br \/>\n$version=Read-Host \"Enter a version number\"<\/p>\n<p>#Prompt for date<br \/>\n$resp=Read-Host \"Enter a last updated date or press Enter for the current date.\"<br \/>\nif ($resp)<br \/>\n{<br \/>\n    $verDate=$resp<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n    #use current date<br \/>\n    $verDate=(Get-Date).ToShortDateString()<br \/>\n}<\/p>\n<p>#construct a Notes section<br \/>\n$NoteHere=@\"<br \/>\n.NOTES<br \/>\nNAME        :  {0}<br \/>\nVERSION     :  {1}<br \/>\nLAST UPDATED:  {2}<br \/>\nAUTHOR      :  {3}\\{4}<\/p>\n<p>\"@<\/p>\n<p>#insert the values<br \/>\n$Notes=$NoteHere -f $Name,$version,$verDate,$env:userdomain,$env:username<\/p>\n<p>#add the section to help<br \/>\n$help+=$Notes<\/p>\n<p>#prompt for URL Link<br \/>\n$url=Read-Host \"Enter a URL link. This is optional\"<br \/>\nif ($url)<br \/>\n{<br \/>\n$urlLink=@\"<br \/>\n.LINK<br \/>\n$url<\/p>\n<p>\"@<\/p>\n<p>#add the section to help<br \/>\n$help+=$urlLink<br \/>\n}<\/p>\n<p>#prompt for comma separated list of links<br \/>\n$links=Read-Host \"Enter a comma separated list of Link references or leave blank for none\"<br \/>\nif ($links)<br \/>\n{<br \/>\n#define a here string<br \/>\n$linkHelp=@\"<br \/>\n.LINK<\/p>\n<p>\"@<\/p>\n<p>#add each link<br \/>\nForeach ($link in $links.Split(\",\")) {<br \/>\n    #insert the link and a new line return<br \/>\n    $linkHelp+=\"$link `n\"<br \/>\n}<br \/>\n#add the section to help<br \/>\n$help+=$linkHelp<\/p>\n<p>}<\/p>\n<p>#Inputs<br \/>\n$inputHelp=@\"<br \/>\n.INPUTS<br \/>\n{0}<\/p>\n<p>\"@<\/p>\n<p>$Inputs=Read-Host \"Enter a description for any inputs. Leave blank for NONE.\"<br \/>\nif ($inputs)<br \/>\n{<br \/>\n    #insert the input value and append to the help comment<br \/>\n    $help+=($inputHelp -f $inputs)<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n   #use None as the value and insert into the help comment<br \/>\n   $help+=($inputHelp -f \"None\")<br \/>\n}<\/p>\n<p>#outputs<br \/>\n$outputHelp=@\"<br \/>\n.OUTPUTS<br \/>\n{0}<\/p>\n<p>\"@<br \/>\n$Outputs=Read-Host \"Enter a description for any outputs. Leave blank for NONE.\"<br \/>\nif ($Outputs)<br \/>\n{<br \/>\n    #insert the output value and append to the help comment<br \/>\n    $help+=($outputHelp -f $Outputs)<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n   #use None as the value and insert into the help comment<br \/>\n   $help+=($outputHelp -f \"None\")<br \/>\n}<\/p>\n<p>#close the help comment<br \/>\n$help+=\"#>\"<\/p>\n<p>#if ISE insert into current file<br \/>\nif ($psise)<br \/>\n{<br \/>\n    $psise.CurrentFile.Editor.InsertText($help) | Out-Null<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n    #else write to the pipeline<br \/>\n    $help<br \/>\n}<\/p>\n<p>} #end function<br \/>\n[\/cc]<\/p>\n<p>The function uses a series of Read-Host commands to prompt for items like the Synopsis and Description. To get all the parameters was a little trickier. If you are editing the function in the PowerShell ISE and run the script, this will dot source the function in the current session. Or you could manually dot source it in the regular console. My function asks for the command name and checks to see if the command is currently loaded.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nTry<br \/>\n{<br \/>\n    $command=get-command -Name $name -ErrorAction Stop<br \/>\n    $params=$command.parameters.keys | where {$_ -notmatch $common}<br \/>\n}<br \/>\n[\/cc]<\/p>\n<p>If found, the function retrieves all the parameter names, except those that match the common parameters like ErrorAction. If the command is not found, then you are prompted for a script name.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n    $scriptname=Read-Host \"If your command is a script file, enter the full file name with extension. Otherwise leave blank\"<br \/>\n[\/cc]<\/p>\n<p>At which point, the same Get-Command code is used to retrieve parameters. You only need to enter something if you are trying to add comment help to a script and not a function. If this is the case, enter the full path and filename to the .ps1 file. Otherwise, the assumption is that you are working on a function in which case leave the script file blank and then you'll be prompted to enter a comma separated list of parameter names.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n #prompt for a comma separated list of parameter names<br \/>\n        $EnterParams=Read-Host \"Enter a comma separated list of parameter names\"<br \/>\n        $Params=$EnterParams.Split(\",\")<br \/>\n[\/cc]<\/p>\n<p>The function will go through each parameter, prompting you for a short description. The parameter section is defined with a here string and appended to the overall help comment.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nForeach ($param in $params) {<br \/>\n    #prompt for a description for each parameter<br \/>\n    $paramDesc=Read-host \"Enter a short description for parameter $($Param.ToUpper())\"<br \/>\n    #define a new line<br \/>\n#this must be left justified to avoid a parsing error<br \/>\n$paramHelp=@\"<br \/>\n.PARAMETER $Param<br \/>\n$paramDesc<\/p>\n<p>\"@<\/p>\n<p>    #append the parameter to the help comment<br \/>\n    $help+=$paramHelp<br \/>\n    } #foreach<br \/>\n[\/cc]<\/p>\n<p>You are prompted for an example command and description. The function uses a Do loop so you can add as many examples as you want.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nDo<br \/>\n{<br \/>\n    #prompt for an example command<br \/>\n    $example=Read-Host \"Enter an example command. You do not need to include a prompt. Leave blank to continue\"<br \/>\n    if ($example)<br \/>\n    {<\/p>\n<p>    #prompt for an example description<br \/>\n    $exampleDesc=Read-Host \"Enter a brief description of this example\"<\/p>\n<p>#this must be left justified to avoid a parsing error<br \/>\n$exHelp=@\"<br \/>\n.EXAMPLE<br \/>\nPS C:\\> $example<br \/>\n$exampleDesc<\/p>\n<p>\"@    <\/p>\n<p>    #add the example to the help comment<br \/>\n    $help+=$exHelp<br \/>\n    } #if $example<\/p>\n<p>} While ($example)<br \/>\n[\/cc]<\/p>\n<p>The rest of the prompts are self-explanatory. But once the function defines the comment string, what next? Well, if the function detects I'm in the ISE then it inserts the comment into the current location of the current file. Otherwise, it simply writes it to the pipeline.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#if ISE insert into current file<br \/>\nif ($psise)<br \/>\n{<br \/>\n    $psise.CurrentFile.Editor.InsertText($help) | Out-Null<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n    #else write to the pipeline<br \/>\n    $help<br \/>\n}<br \/>\n[\/cc]<\/p>\n<p>My reason for this behavior is because in my ISE profile I dot source the New-CommentHelp.ps1 script. Then I add a new item to the Add-Ons menu.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n. C:\\scripts\\New-CommentHelp.ps1<br \/>\n$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(\"Add Help\",{New-CommentHelp},\"ALT+H\") | Out-Null<br \/>\n[\/cc]<\/p>\n<p>Now, when I'm working on a new function in the ISE I position my cursor after the Function declaration and press Alt+H.  Assuming I've loaded the function into the ISE, the \"wizard\" will find it and prompt for everything I need, including the parameters. Once inserted, I can then tweak and edit. This is an important note: the comment based help will likely need minor tweaks and edits given the limitations of Read-Host. But at least you'll have the vast majority of the work already completed.  <\/p>\n<p>If you are using this from the PowerShell console, I would save the results to a variable.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> $h=New-CommentHelp<br \/>\n[\/cc]<\/p>\n<p>Follow the prompts and when complete you can pipe $h to a file or wherever you need it. Here's a sample of the help comment created by the function.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n<#\n.SYNOPSIS\nCalculate the area of a circle\n.DESCRIPTION\nThis command will return a value for the area of a circle based on a given radius.\n.PARAMETER Radius\nThe length of the circle's radius, greater than 0.\n.EXAMPLE\nPS C:\\> Get-Radius 4<br \/>\nReturns the area of a circle with a radius of 4.<br \/>\n.NOTES<br \/>\nNAME        :  Get-Area<br \/>\nVERSION     :  0.1<br \/>\nLAST UPDATED:  3\/29\/2011<br \/>\nAUTHOR      :  QUARK\\Jeff<br \/>\n.LINK<br \/>\nhttp:\/\/jdhitsolutions.com\/blog<br \/>\n.LINK<br \/>\nabout_Arithmetic_Operators<br \/>\n.INPUTS<br \/>\nNone<br \/>\n.OUTPUTS<br \/>\n[double]<br \/>\n#><br \/>\n[\/cc]<\/p>\n<p>Adding comment-based help to your scripts and functions should score you extra brownie points and gold stars in the Scripting Games, and definitely makes work easier to use and understand.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/New-CommentHelp.txt' target='_blank'>New-CommentHelp<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you follow my blog I&#8217;m sure you noticed that I post a lot of advanced functions and scripts. While I don&#8217;t expect every one to be developing advanced functions, the closer you can get the more powerful your work. With the Scripting Games approaching I thought I&#8217;d offer up a little something to help&#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,231,75,8],"tags":[32,76,232,534,272,540],"class_list":["post-1292","post","type-post","status-publish","format-standard","hentry","category-powershell","category-powershell-ise","category-powershell-v2-0","category-scripting","tag-functions","tag-help","tag-ise","tag-powershell","tag-read-host","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>New Comment Help &#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\/1292\/new-comment-help\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"New Comment Help &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"If you follow my blog I&#039;m sure you noticed that I post a lot of advanced functions and scripts. While I don&#039;t expect every one to be developing advanced functions, the closer you can get the more powerful your work. With the Scripting Games approaching I thought I&#039;d offer up a little something to help...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-03-29T13:44:33+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"New Comment Help\",\"datePublished\":\"2011-03-29T13:44:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/\"},\"wordCount\":1162,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/03\\\/helpbubble.png\",\"keywords\":[\"functions\",\"Help\",\"ISE\",\"PowerShell\",\"Read-Host\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"PowerShell ISE\",\"PowerShell v2.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/\",\"name\":\"New Comment Help &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/03\\\/helpbubble.png\",\"datePublished\":\"2011-03-29T13:44:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#primaryimage\",\"url\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/03\\\/helpbubble.png\",\"contentUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/03\\\/helpbubble.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1292\\\/new-comment-help\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"New Comment Help\"}]},{\"@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":"New Comment Help &#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\/1292\/new-comment-help\/","og_locale":"en_US","og_type":"article","og_title":"New Comment Help &#8226; The Lonely Administrator","og_description":"If you follow my blog I'm sure you noticed that I post a lot of advanced functions and scripts. While I don't expect every one to be developing advanced functions, the closer you can get the more powerful your work. With the Scripting Games approaching I thought I'd offer up a little something to help...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-03-29T13:44:33+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"New Comment Help","datePublished":"2011-03-29T13:44:33+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/"},"wordCount":1162,"commentCount":5,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.png","keywords":["functions","Help","ISE","PowerShell","Read-Host","Scripting"],"articleSection":["PowerShell","PowerShell ISE","PowerShell v2.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/","name":"New Comment Help &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.png","datePublished":"2011-03-29T13:44:33+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#primaryimage","url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.png","contentUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/helpbubble.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1292\/new-comment-help\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"New Comment Help"}]},{"@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":1729,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1729\/ise-scripting-geek-module\/","url_meta":{"origin":1292,"position":0},"title":"ISE Scripting Geek Module","author":"Jeffery Hicks","date":"October 27, 2011","format":false,"excerpt":"Over the last year I've posted functions I've written to extend the Windows PowerShell ISE. I have finally pulled everything together into a module I'm calling the ISE Scripting Geek. Download and extract the zip file (below) to your modules folder. You should end up with a path like 'C:\\Users\\Jeff\\Documents\\WindowsPowerShell\\Modules\\ISEScriptingGeek'.\u2026","rel":"","context":"In &quot;PowerShell ISE&quot;","block_context":{"text":"PowerShell ISE","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-ise\/"},"img":{"alt_text":"ISE Scripting Geek add-on menu","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/isescriptinggeek-300x200.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3117,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3117\/msdevwny-powershell-advanced-functions\/","url_meta":{"origin":1292,"position":1},"title":"MSDevWNY PowerShell Advanced Functions","author":"Jeffery Hicks","date":"June 20, 2013","format":false,"excerpt":"Last night I presented for the MSDevWNY user group in the Buffalo, NY area. They were an interested and enthusiastic audience and I think we could have spent another few hours talking about PowerShell. My presentation was one I've given before on Advanced PowerShell functions. I promised the group a\u2026","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"talkbubble-v3","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/talkbubble-v3-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3990,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3990\/friday-fun-creating-powershell-scripts-with-powershell\/","url_meta":{"origin":1292,"position":2},"title":"Friday Fun: Creating PowerShell Scripts with PowerShell","author":"Jeffery Hicks","date":"September 5, 2014","format":false,"excerpt":"Sometimes PowerShell really does seem like magic. Especially when you can use it to handle complicated or tedious tasks, such as creating a PowerShell script. I know many an IT Pro who want to script but without having to actually write a script. Well, I'm not sure that is realistic,\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"012914_1704_CreatingCIM1.png","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/01\/012914_1704_CreatingCIM1-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2318,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2318\/introducing-the-scriptinghelp-powershell-module\/","url_meta":{"origin":1292,"position":3},"title":"Introducing the ScriptingHelp PowerShell Module","author":"Jeffery Hicks","date":"May 16, 2012","format":false,"excerpt":"Over the last few weeks I've posted articles on the different parameter validation options in Windows PowerShell. More than one person suggested consolidating the articles. That seemed like a good idea. There were a variety of ways to handle this but I wanted something more PowerShell-oriented. Then I realized, why\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\/03\/helpbubble.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":467,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/467\/get-numberedcontent-v2\/","url_meta":{"origin":1292,"position":4},"title":"Get-NumberedContent v2","author":"Jeffery Hicks","date":"October 22, 2009","format":false,"excerpt":"I wasn\u2019t completely satisfied with the updated version of my Get-NumberedContent function. You should still refer to the earlier post for details on how to use the function. But I had some issues with the previous version and realized there were a few bugs. I\u2019ve since updated the Get-NumberedContent function.\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2330,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2330\/friday-fun-get-latest-powershell-scripts\/","url_meta":{"origin":1292,"position":5},"title":"Friday Fun: Get Latest PowerShell Scripts","author":"Jeffery Hicks","date":"May 18, 2012","format":false,"excerpt":"Probably like many of you I keep almost all of my scripts in a single location. I'm also usually working on multiple items at the same time. Some times I have difficult remembering the name of a script I might have been working on a few days ago that I\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/get-latestscript-300x133.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1292","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=1292"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1292\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}