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:
1Save-Help : No Windows PowerShell modules were found that match the following pattern:
2ServerCore. Verify the pattern and then try the command again.
3At line:1 char:1
4+ Save-Help -Module ServerCore -DestinationPath \dc01PSHelp -Force
5+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6+ CategoryInfo : InvalidArgument: (ServerCore:String) [Save-Help], Exception
7+ 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.
µ