When you develop scripts for other computers you don’t always have the luxury of installing the relevant modules on your own computer. In many cases they simply won’t install because you are running the wrong OS or don’t have some required server software running. Luckily the context sensitive help in PrimalScript or PowerShell Studio doesn’t rely on the actual module being installed like PowerShell’s Get-Help does.
In this post we will show you how to export a help file from your target machine and add it to the SAPIEN Document Explorer locally.
As an example we will use the Microsoft.WSMan.Management module from a Windows 8 machine, simply because it has a help file and an about file. That way we can show you how to import both in one example.
With PowerShell V3 you can simply use the Save-Help CmdLet and export the relevant files to a folder of your choosing.
Save-Help creates two files in the specified folder, an XML file and a CAB file. We have no use for the XML file, so feel free to delete that. Double click on the CAB file to view it’s content.
This particular cab file contains an about text file and the help content as an xml file. Copy these two files out of the cab file to a location where you can get to them from your own computer.
Now, back at your own computer open SAPIEN Document Explorer and select “Import Module/Snapin XML help file…”
Note: Older versions of the Document Explorer may just say “Import Snapin XML help file…”. Don’t worry, it will do the same thing.
Navigate to the XML file you copied out of the CAB file and select it.
Now if you look for the Cmdlets from that module they will be right there:
Now you can read the help files for modules not installed on your machine at your leisure and get help for these things when you press F1 in PrimalScript.
Importing about files is equally easy, just select “Import About files…” from the Edit menu:
Note that here you don’t select a file but a folder. SAPIEN Document Explorer will just import everything matching about_*.txt from that folder.
In closing, make sure you hang on to the files you just imported. There are updates coming to the Document Explorer that may require you to re-import these files. We will try to avoid that, but keep them just in case.
We should also note that we discovered that some PowerShell V3 help files have a little formatting change that may prevent some cmdlets from showing any help content. We are aware of that and will have an update soon.