{"id":10611,"date":"2006-04-25T12:18:11","date_gmt":"2006-04-25T12:18:11","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2006\/04\/25\/adding-help-for-cmdlets-in-a-mshsnapin\/"},"modified":"2019-02-18T13:24:56","modified_gmt":"2019-02-18T20:24:56","slug":"adding-help-for-cmdlets-in-a-mshsnapin","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/adding-help-for-cmdlets-in-a-mshsnapin\/","title":{"rendered":"Adding help for cmdlets in a MshSnapIn"},"content":{"rendered":"<p><span>Now that you know how to create an MshSnapIn, you might want to add help content for all those cmdlets that you developed and get them displayed by \u201cget-help\u201d cmdlet. <span>&nbsp;<\/span>To add help content you&nbsp;must know how a Monad Cmdlet Help file looks. See any of the *-Help.xml files in Monad installation directory for reference. I wont be describing the format of the help file in this blog (I will do that on some other day. In the mean time please use one of the *-Help.xml files for your reference). <\/span><\/p>\n<p><span>When &#8220;add-mshsnapin <\/span><span>XYZ.TestNameSpace.MyMshSnapIn&#8221; is run on the command-line, Monad engine will look for snapin information under registry key HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSH\\1\\MshSnapIns\\{Your_MshSnapIn_Key here}. This key will have information like ApplicationBase, AssemblyName, etc. The monad engine loads the assembly (and if everything succeeds), identifies all the cmdlets\/providers that are defined in MshSnapIn assembly. Along with all the necessary information that is required, the engine will add a default help file name which is of format &lt;MshSnapIn assembly name&gt;.dll-Help.xml for every cmdlet\/provider that is present in the MshSnapIn assembly.<\/span><\/p>\n<p><span>Later when help engine tries to load help file for a cmdlet, the help engine looks for the help file relative to MshSnapIn \u201cApplicationBase\u201d directory. Remember this ApplicationBase is added to the registry during MshSnapIn installation phase.<\/span><\/p>\n<p><span>You can control the name of the help file ( infact you can have a separate helpfile for each of your cmdlets\/providers ) by creating a Custom MshSnapIn<\/span><\/p>\n<p><span>So here are the steps to add help content to your MshSnapIns:<\/span><\/p>\n<p><span>Create a help file and name it as appropriate<\/span><\/p>\n<p><span>(a) If your snapin is a general MshSnapIn (ie., deriving from System.Management.Automation.MshSnapIn) name it &lt;your dll name&gt;.dll-Help.xml<\/span><\/p>\n<p><span>(b) If your snapin is a custom MshSnapIn (ie., deriving from System.Management.Automation.CustomMshSnapIn) name it according to the information you supplied with \u201c<span>public override Collection&lt;CmdletConfigurationEntry&gt; Cmdlets\u201d property.<\/span><\/span><\/p>\n<p><span>When your snapin is deployed make sure the help files are deployed to the same location relative to ApplicationBase.<\/span><\/p>\n<p><span>If you follow the above steps, then \u201cget-help &lt;Your custom MshSnapIn cmdlet&gt;\u201d should display help for your cmdlets.<\/span><\/p>\n<p><span>Hope this helps.<\/span><\/p>\n<p><span>&#8212;<\/span><\/p>\n<p><span>Krishna<\/span><span> Vutukuri [MSFT]<\/span><\/p>\n<p><span>Monad Development<br \/>Microsoft Corporation<br \/>This posting is provided &#8220;AS IS&#8221; with no warranties, and confers no rights.<\/span><span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>[<i>Edit: Monad has now been renamed to Windows PowerShell.  This script or discussion may require slight adjustments before it applies directly to newer builds.<\/i>]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that you know how to create an MshSnapIn, you might want to add help content for all those cmdlets that you developed and get them displayed by \u201cget-help\u201d cmdlet. &nbsp;To add help content you&nbsp;must know how a Monad Cmdlet Help file looks. See any of the *-Help.xml files in Monad installation directory for reference. [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10611","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Now that you know how to create an MshSnapIn, you might want to add help content for all those cmdlets that you developed and get them displayed by \u201cget-help\u201d cmdlet. &nbsp;To add help content you&nbsp;must know how a Monad Cmdlet Help file looks. See any of the *-Help.xml files in Monad installation directory for reference. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/10611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=10611"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/10611\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=10611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=10611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=10611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}