1

I am running PowerShell Core 7.2.6 installed via homebrew on MacBook Air M1 (12.6). However, when I try to use the help module to find some examples , I get this error.

REMARKS
Get-Help cannot find the Help files for this cmdlet on this computer. It 
is displaying only partial help.
    -- To download and install Help files for the module that includes 
this cmdlet, use Update-Help.
    -- To view the Help topic for this cmdlet online, type: "Get-Help 
Find-Module -Online" or
       go to https://go.microsoft.com/fwlink/?LinkID=398574.

I have tried to update the help module but no luck, same with uninstalling it and reinstalling it.

mklement0
  • 382,024
  • 64
  • 607
  • 775
Yashcrest
  • 39
  • 3
  • What does “no luck” mean? Do you get errors? – Doug Maurer Sep 23 '22 at 13:30
  • 1
    I don't know if MacOS has the same concept (I'm a Windows guy), but on Windows, in order to update the help files, you need to open Powershell as an "elevated" session, or "Run as Administrator", then do the `Update-Help`. You might also be able to view the complete help information with `Get-Help -Online «cmd»` – Jeff Zeitlin Sep 23 '22 at 13:46
  • @DougMaurer , says updating help module for Microsoft.Powershell...[Locating help content..] But after that its still the same result when I run the help command. – Yashcrest Sep 23 '22 at 14:08
  • @JeffZeitlin thanks jeff for your input. I did try from the "sudo" command but for some reason still not updating the help module. And yes, I am aware that I can find the commands help in Microsoft docs but just wanted to find the root cause of this bug. – Yashcrest Sep 23 '22 at 14:11

2 Answers2

3

Note: See Sotiris's helpful answer for the potential need to use -UICulture en-US, and for specifics on how the PowerShellGet module's help is broken.


It is implied by the Get-Help error message you're seeing, but to spell it out in more detail:

  • The command you're trying to invoke help for is a cmdlet and therefore part of a module.

  • That module's manifest defines an online help source, via its HelpInfoURI entry, but no local (offline) help content has ever been downloaded.

    • This is typical for the built-in modules that come with PowerShell (Core) 7+, the only edition available on non-Windows platforms such as macOS.
    • It can conceivably also happen with third-party modules, although the ones available via the PowerShell Gallery and installed via Install-Module usually come bundled with their offline help content.

As the error message suggests, Update-Help must be used to download such help content on demand; see the next section for details and general troubleshooting tips.

However, the problem in your specific case - trying to invoke local help for the Find-Module cmdlet - is that the downloadable help content for the specific PowerShellGet module that the Find-Module cmdlet is a part of appears to be broken as of this writing.

If you run the following command, you'll see that Update-Help downloads help content, but it seemingly isn't recognized; that is, running Update-Help makes no effective difference.

# Output shows that the following file is updated:
#  $HOME/.local/share/powershell/Help/PowerShellGet/en-US/PSModule-help.xml
Update-Help -Force -Verbose -Module PowerShellGet 

Therefore:

  • I encourage you to report an issue in PowerShellGet's GitHub repo.

  • As a workaround - assuming you're connected to the internet - use the -Online switch for now so as to open the help content in your default web browser (you cannot directly pass -Examples then, but just click the "Examples" link on the right-hand side to jump to the examples section).


Using and troubleshooting Update-Help:

  • Note that there is no help module as such (it sounds like you meant the help command, which is a function wrapper around Get-Help that provides interactive paging of long output from the latter). There's the Get-Help cmdlet that is part of the Microsoft.PowerShell.Core module, and there's downloaded help content, which you may have to download on demand via Update-Help:

    • Update-Help without a -Scope argument in PowerShell (Core) 7+ defaults to -Scope CurrentUser, which means that the help content is downloaded to a user-specific location.

    • With -Scope AllUsers (the default in Windows PowerShell, where no -Scope parameter exists), you need to run with elevation (as admin) on Windows, and via sudo powershell on macOS and Linux.

    • Use -Force to ensure that content is always downloaded, if available. According to the docs, -Force bypasses two built-in constraints: permitting only a single run per day, and limiting the download data volume to 1GB (though exceeding that seems unlikely).

    • Add -Verbose to get details about the operations performed by Update-Help, which includes the modules targeted and their online source URLs, as well as whether updated content was found and downloaded.

    • You can also limit Update-Help to updating the help for (a) given module(s) (-Module) and/or specific cultures (human languages) (-UICulture).

      • To learn the name of a module that a given command is part of, if any, use the following, using Get-Content as an example: (Get-Command Get-Content).Module.Name; note that you must use the actual command name, not an alias for it (such as gc); for an alias, use something like (Get-Command gc).ResolvedCommand.Module.Name

      • By default, content matching the current UI culture (as reflected in $PSUICulture) is downloaded; if no such content is available, but the content is available for other UI cultures, the resulting error message will list those.

  • However, even then it isn't guaranteed that help becomes available for all commands available in your session, given that implementing command-line help is optional (though recommended).

    • If there's no error message when you run Update-Help -Force yet no help content becomes available, the implication is that no online source for a module that a given command is part of, if any, is defined.

      • However, if you target such a module explicitly with -Module, the absence of an online source does result in an error to that effect.

      • It is the HelpInfoURI entry in a module's manifest that defines an online help source.

    • If an online source is defined, but not reachable / doesn't have the expected content, you'll get an error message.

mklement0
  • 382,024
  • 64
  • 607
  • 775
2

I had a similar issue and, asking in PowerShell's discord server, the answer turned out to be that there wasn't any documentation available for my culture. Doing

Update-Help -UICulture en-US -Force

solved the problem by downloading the documentation for the en-US culture.

However, as mklement0 mentioned in his answer, the help for this particular module seems to be broken. Looking into PowerShellGet files, the module uses different names for the module (PowerShellGet), and the file containing the code (PSModule.psm1). Although, this shouldn't be a problem, as the module uses the #.ExternalHelp directive for function help which doesn't have any specific naming requirements, it seems it doesn't work correctly.

A quick fix for this that apparently works is to change the name of the help file from 'PSModule-help.xml' to 'PowerShellGet-help.xml'. This file is under

$HOME\Documents\PowerShell\Help\PowerShellGet\en-US

for Windows systems, or

$HOME/.local/share/powershell/Help/PowerShellGet/en-US

for non-Windows systems.

Note, that even if you do this, you won't be able to get help for Get-CredsFromCredentialProvider as it is missing from the .xml help file. However, this is an internal function that wasn't meant to be exported in the first place, so the missing documentation is actually deliberate. Still, if you want to check out what it was, you can check it out here (though there's not any interesting content whatsoever :) )!

mklement0
  • 382,024
  • 64
  • 607
  • 775
Sotiris
  • 81
  • 4
  • Hi Sotiris, I believe the PowerShellGet team has fixed this. I did raise an issue on their github repo regarding this. They guided me saying that the command is slightly different in the PS7 but I believe this normal command "get-help find-module -Examples" is also working now. :) Thanks for your input though, really appreciate it. :) – Yashcrest Jun 10 '23 at 05:02