PowerShell ExternalHelp

Ask your 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.
This topic is 5 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
madmonky
Posts: 3
Last visit: Wed Jan 03, 2024 3:21 pm

PowerShell ExternalHelp

Post by madmonky »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: PowerShell ExternalHelp

Post by Alexander Riedel »

[Moved to correct forum by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PowerShell ExternalHelp

Post by jvierra »

Is the module in the module path or is it still in the project folder. It must be in the module path.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PowerShell ExternalHelp

Post by jvierra »

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
Last visit: Wed Jan 03, 2024 3:21 pm

Re: PowerShell ExternalHelp

Post by madmonky »

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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PowerShell ExternalHelp

Post by jvierra »

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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PowerShell ExternalHelp

Post by jvierra »

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

$env:PSModulePath -split ';'
User avatar
madmonky
Posts: 3
Last visit: Wed Jan 03, 2024 3:21 pm

Re: PowerShell ExternalHelp

Post by madmonky »

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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: PowerShell ExternalHelp

Post by jvierra »

Be sure your naming conventions are correct. The help has to match the module manifest name correctly.
This topic is 5 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked