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

save-help1.png

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:

save-help2b.png

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:

save-help3.png

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

save-help4.png

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

save-help5.png

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:

save-help6.png

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

save-help7.png

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

save-help8.png

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:

save-help9.png

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.

µ