PowerShell ExternalHelp

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
madmonky
Posts: 3
Joined: Sun Mar 03, 2013 12:42 pm

PowerShell ExternalHelp

Post by madmonky » Fri Aug 17, 2018 5:10 am

I'm having an issue using ExternalHelp and cannot figure what I'm doing wrong. I'm using PowerShell Studio 2018 to create my PowerShell Script Module and PowerShell HelpWriter 2018 to write my help documentation. The XML file generated by PowerShell HelpWriter is in the en-US sub directory of my PowerShell script module, however, Get-Help will not return the help from the XML file. If I specify the full path to the XML file in the ExternalHelp comment, it works, but if I specify just the XML file name, it does not. Any help would be greatly appreciated.

User avatar
Alexander Riedel
Posts: 6921
Joined: Tue May 29, 2007 4:43 pm

Re: PowerShell ExternalHelp

Post by Alexander Riedel » Fri Aug 17, 2018 7:16 am

[Moved to correct forum by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
jvierra
Posts: 13507
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: PowerShell ExternalHelp

Post by jvierra » Fri Aug 17, 2018 9:54 am

Is the module in the module path or is it still in the project folder. It must be in the module path.

User avatar
jvierra
Posts: 13507
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: PowerShell ExternalHelp

Post by jvierra » Fri Aug 17, 2018 10:00 am

This might also be helpful. Naming and other issues for external help is required.

https://info.sapien.com/index.php/scrip ... -functions

User avatar
madmonky
Posts: 3
Joined: Sun Mar 03, 2013 12:42 pm

Re: PowerShell ExternalHelp

Post by madmonky » Fri Aug 17, 2018 11:54 am

This is what I've done:
Module name is MyFirstModule
Module directory is D:\MyFirstModule
Help file name D:\MyFirstModule\en-US\MyFirstModule.psm1-Help.xml

My module is comprised of a .PSD1, a .PSM1 and several .PS1 files. The .PSM1 file is emply. The .PSD1 uses the NestModules array to include all the .PS1 files. Each .PS1 file contains a single function and the first comment (above function) is # .ExternalHelp MyFirstModule.psm1-Help.xml. I don't have code in the .PSM1 file because I want to make it easier to manage my functions by keeping them in separate files.
If I replace # .ExternalHelp MyFirstModule.psm1-Help.xml with # .ExternalHelp D:\MyFirstModule\en-US\MyFirstModule.psm1-Help.xml
then the help works without issue.

User avatar
jvierra
Posts: 13507
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: PowerShell ExternalHelp

Post by jvierra » Fri Aug 17, 2018 12:07 pm

The module has to be in the module folder not just in any folder.

The default user module folder is here:
$env:USERPROFILE\Documents\WindowsPowerShell\Modules

User avatar
jvierra
Posts: 13507
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: PowerShell ExternalHelp

Post by jvierra » Fri Aug 17, 2018 12:09 pm

Here is how to find all of your current module paths:

$env:PSModulePath -split ';'

User avatar
madmonky
Posts: 3
Joined: Sun Mar 03, 2013 12:42 pm

Re: PowerShell ExternalHelp

Post by madmonky » Wed Aug 22, 2018 4:15 pm

Unfortunately, that is not working for me for some reason. I placed the module in the $env:USERPROFILE\Documents\WindowsPowerShell\Modules folder under a subfolder with the same name as the module and still help does not come up.

User avatar
jvierra
Posts: 13507
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: PowerShell ExternalHelp

Post by jvierra » Wed Aug 22, 2018 4:30 pm

Be sure your naming conventions are correct. The help has to match the module manifest name correctly.

Locked