PowerShell: Save-Help for Modules that Aren’t Installed on the Local Computer

Update-Help and Save-Help are new PowerShell version 3 cmdlets which allow you to initially download PowerShell help and keep the local PowerShell help files updated that are installed on your computer and available via the Get-Help cmdlet.

In PowerShell version 3, Save-Help allows the updated help files to be saved to a location where a machine that doesn’t have Internet access can update it’s help from. The problem is that in order to save help for a module, that module has to exist on the local computer that’s performing the actual download otherwise an error will be generated:

Save-Help : No Windows PowerShell modules were found that match the following pattern:
ServerCore. Verify the pattern and then try the command again.
At line:1 char:1
+ Save-Help -Module ServerCore -DestinationPath \dc01PSHelp -Force
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (ServerCore:String) [Save-Help], Exception
+ FullyQualifiedErrorId : ModuleNotFound,Microsoft.PowerShell.Commands.SaveHelpCommand

Now this is definitely unsupported, but what I’ve found is you can copy the module manifest file (.psd1 file) from a machine that has the module installed to the computer you’re going to run the Save-Help cmdlet on to trick it into thinking the module is installed:

So all I’ve done is created a sub folder in my modules directory and place the manifest file in it for the module that’s not installed but that I want to download the help for:

Once that’s complete, saving the help for that particular module works without issue:

This flashes by fairly quickly when the help is being downloaded:

Now the help for that module is located on the network share that it was directed to using the Save-Update cmdlet with the -DestinationPath parameter:

On a server without an Internet connection, when trying to update the help, you’ll receive the following error:

When specifying the location using the -SourcePath parameter with Update-Help, the help on this server without an Internet connection completes without issue:

Now the cool thing about remoting being enabled by default on Windows Server 2012 is you can update the help remotely using the Invoke-Command cmdlet:

I have a couple of additional ideas about how to save the help for modules that aren’t installed on the local computer so check back on Thursday for part 2 of this blog article.

µ

5 Comments

  1. Peter Kriegel

    PowerShell MVP Ravikanth Chaganti has done a Module for this problem:
    http://www.ravichaganti.com/blog/?p=2501

    and I have doen a few Articles about in my German Blog (you can use the Translate Button)
    http://www.admin-source.de/BlogDeu/497/powershell-3-0-updateable-help-update-help-save-help-und-get-help-grundlagen

    http://www.admin-source.de/BlogDeu/523/powershell-3-0-updateable-help-update-help-save-help-und-get-help-anwenden

    in the third part i will offer an updated Module with better Proxy support and a better URI collector.

    Greets Peter Kriegel
    http://www.admin-source.de

    Reply
  2. Peter Kriegel

    Here are my 3thrd Article with the Updateable-HelpProxy Module.
    I have mentioned your Aticles in there.
    For me, the original function from the module by Ravikanth Chaganti did not work.
    So i have modified and extended the original module
    Also Invoke-WebRequest cmdlet contained in the PowerShell 3.0 was not compatible with our proxy.
    My module therefore uses internally the Get-Webfile (wget for PowerShell) by Joel Bennett to download the files.
    This function I added the proxy properties.
    The function, and thus the function Save-Help proxy attempts to find the proxy automatically and thereby are the credentials of the current user used.
    With a single sign on proxy and automatic settings can therefore first of all try to dont provide any proxy parameter informations.
    The two major functions in the module are well documented (with my bad English 😉 ).

    Cheers Thank you for your good work Peter Kriegel
    http://www.admin-source.de/BlogDeu/548/save-help-im-unternehmen-fuer-offline-rechner-auch-mit-einem-proxy-benutzen

    Reply
  3. Espen

    Hi Mike, interesting tip! However, I was not able to use this trick for the ActiveDirectory module. Have you by any chance tried that yourself?

    Reply

Leave a Reply

%d bloggers like this: