2 minutes reading time (492 words)

The PowerShell Book Generator

PowerShellBlueb

Have you always wanted to write a book with 100 or even 1000 or more pages? With Windows PowerShell and PowerShell Book Generator, it takes only a few seconds. The PowerShell Book Generator was created by the way on the last PSConf.eu and afterwards (I try to fill the time optimally and I hope to see you there again @psconf.eu in June 2020). Basically it is about implementing the internal PowerShell help for a topic completely in book form as PDF with table of contents.The idea came to me when I saw that there are more and more books where more and more content is simply copied from the internal help into the document. Of course the generator can also be used to document your own PowerShell modules. How does the internal PowerShell help work?

With Get-Commmand -Module <ModuleName>

the functions and CmdLets of a module can be retrieved.

PS C:\Windows\system32> get-command -Module AppvClient
CommandType Name Version Source
----------- ---- ------- ------
Function Get-AppvVirtualProcess 1.0.0.0 AppvClient
Function Start-AppvVirtualProcess 1.0.0.0 AppvClient
Cmdlet Add-AppvClientConnectionGroup 1.0.0.0 AppvClient
Cmdlet Add-AppvClientPackage 1.0.0.0 AppvClient
Cmdlet Add-AppvPublishingServer 1.0.0.0 AppvClient
Cmdlet Disable-Appv 1.0.0.0 AppvClient
Cmdlet Disable-AppvClientConnectionGroup 1.0.0.0 AppvClient
Cmdlet Enable Appv 1.0.0.0 AppvClient
#....

For each commandlet the complete help can now be called up again. As return value we get an object with help information.

PS C:\Windows\system32> get-Help Get-AppvVirtualProcess
NAME
    Get-AppvVirtualProcess
OVERVIEW
    Displays the virtual processes running on a computer.
SYNTAX
    Get-AppvVirtualProcess [[-Name] <String[]>] [-ComputerName <String[]>] [-FileVersionInfo] [-Modules] [<CommonParameters>]
    Get-AppvVirtualProcess [-ComputerName <String[]>]  [-FileVersionInfo] [-Modules] -Id <Int32[]> [<CommonParameters>] 
    Get-AppvVirtualProcess [-ComputerName <String[]>]  [-FileVersionInfo] [-Modules] [<CommonParameters>] 

This information is retrieved completely (with the paranmeters -Full -Examples). Partly with explanations and examples (depending on the developer) and then processed by the PowerShell Book Generator. You can easily see that this also works for your own modules if they are well documented. Before use First of all the internal PowerShell help should be up to date 

The PowerShell command for this is:  Update-Help

So if there is not much to see in the calls above or in the generated books, an update help should be called first.First the module has to be

imported:Import modules <PathTo>\PowerShellBooks 

Afterwards the book can be generated with New-PowerShellBook <OutputPath> -Module <Modulename>.

Example:

Import modules $PSScriptRoot\PowerShellBooks 
$Module = 'UEV'.
$OutFile = '{0}\desktop\Powershell_With_{1}.pdf' -f $env:userprofile, $Module
New-PowerShellBook -OutputPdfDocument $OutFile -Module $Module

To make life a little easier for the colleagues who don't like to use the PowerShell, I have included a minimal Gui. This is started with the link PowerShellBooksGui. Then select the module and the storage location.To make life a little easier for the colleagues who don't like to use the PowerShell, I have included a minimal Gui. This is started with the link PowerShellBooksGui. Then select the module and the storage location.

PowerShellBookGeneratorGui

Below to download the scripts with the generator. Furthermore some example books.

The generator

Files:

PowerShellBooksGenerator

Update 1.2

=======

* Generate TOC with internal Links

* Executable (EXE) for the GUI (generate PDF Documents from PowerShell Modules Help). Better use the PowerShell and the module!

 

Information
Created 02.02.2020 20:34:53
Changed 08.02.2020 08:58:48
Version 1.2
Size 4.97 MB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 18
License Nick Informationstechnik Tool LicenceTooltip
Price

Some Examples

Powershell_With_AppVClient

Created with the PowerShell Book Generator

Update 1.1: TOC with internal Links

Information
Created 02.02.2020 20:26:09
Changed 08.02.2020 09:02:18
Version 1.1
Size 262.2 KB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 74
License
Price

Powershell_With_AppVSequencer

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:26:59
Changed 02.02.2020 20:29:41
Version
Size 23.51 KB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 53
License
Price

Powershell_With_AppVServer

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:27:34
Changed 02.02.2020 20:29:36
Version
Size 127.64 KB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 45
License
Price

Powershell_With_AppX

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:27:53
Changed 02.02.2020 20:29:16
Version
Size 106.02 KB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 56
License
Price

PowerShell_With_BranchCache

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:28:18
Changed 02.02.2020 20:29:10
Version
Size 234.25 KB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 51
License
Price

Powershell_With_Dism

Created with the PowerShell Book Generator

Very good!

Information
Created 02.02.2020 20:28:56
Changed 02.02.2020 20:29:30
Version
Size 544.99 KB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 73
License
Price

Powershell_With_ActiveDirectory

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:19:17
Changed 02.02.2020 20:29:50
Version
Size 2.29 MB
Created by Andreas Nick
Changed by Andreas Nick
Downloads 67
License
Price

Powershell_With_DnsServer

Powershell_With_DnsServer

Information
Created 02.02.2020 20:30:19
Changed
Version
Size 1.71 MB
Created by Andreas Nick
Changed by
Downloads 87
License
Price

Powershell_With_PrintManagement

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:31:02
Changed
Version
Size 256.72 KB
Created by Andreas Nick
Changed by
Downloads 53
License
Price

Powershell_With_Storage

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:31:24
Changed
Version
Size 1.69 MB
Created by Andreas Nick
Changed by
Downloads 85
License
Price

Powershell_With_UEV

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:32:19
Changed
Version
Size 201.99 KB
Created by Andreas Nick
Changed by
Downloads 82
License
Price

OTPEdit a management tool for One Time Passwords
App-V Server And Package Report

Related Posts

 

Comments 5

Guest - Jeff Hicks on Friday, 07 February 2020 18:46

Is the source in a GitHub repo somewhere?

Is the source in a GitHub repo somewhere?
Andreas Nick on Friday, 07 February 2020 19:32

Hi Jeff, it is a PowerShell Module. You can get it from the PowerShell Gallery (the actual source). Furthermore I will upload a current version to GutHub within the next days.

https://github.com/AndreasNick

Hi Jeff, it is a PowerShell Module. You can get it from the PowerShell Gallery (the actual source). Furthermore I will upload a current version to GutHub within the next days. https://github.com/AndreasNick
Andreas Nick on Wednesday, 05 February 2020 14:11

Thanks for the advice. I should have put that in. But I don't know if the pdf dll can do that. We'll see. Unfortunately, I won't have the chance to do it all too soon.

Thanks for the advice. I should have put that in. But I don't know if the pdf dll can do that. We'll see. Unfortunately, I won't have the chance to do it all too soon.
Guest - Maarten on Monday, 03 February 2020 08:37

Thanks, this is great!! One minor suggestion: Is it possible to create the TOC with hyperlinks ? I managed it to open the pdf in Word, remove the original TOC, add an new TOC and then save it back to pdf.

https://s5.gifyu.com/images/pdftoc.gif

Thanks, this is great!! One minor suggestion: Is it possible to create the TOC with hyperlinks ? I managed it to open the pdf in Word, remove the original TOC, add an new TOC and then save it back to pdf. [img]https://s5.gifyu.com/images/pdftoc.gif[/img]
Andreas Nick on Thursday, 06 February 2020 20:27

as always, it's not quite as easy. I use iTextSharp. This afternoon I took a look at it and really invested a lot of time. When documents are linked with iTextSharp, links and anchors become invalid. You have to correct this later or not link to different documents at all.
To realize everything of course not very fast. I would have to reprogram many things.
Well, finally I found a simple solution. We open the same document and jump to the correct position. $null= $Chunk.SetAction((new-object iTextSharp.text.pdf.PdfAction @(".\Powershell_With_UEV.pdf", $page))
Unfortunately, there is no "back" button. I'll see if I can upload a new version soon.

as always, it's not quite as easy. I use iTextSharp. This afternoon I took a look at it and really invested a lot of time. When documents are linked with iTextSharp, links and anchors become invalid. You have to correct this later or not link to different documents at all. To realize everything of course not very fast. I would have to reprogram many things. Well, finally I found a simple solution. We open the same document and jump to the correct position. $null= $Chunk.SetAction((new-object iTextSharp.text.pdf.PdfAction @(".\Powershell_With_UEV.pdf", $page)) Unfortunately, there is no "back" button. I'll see if I can upload a new version soon.
Already Registered? Login Here
Guest
Thursday, 28 May 2020

Captcha Image

@nickinformation Tweets

My german Blog: 

http://www.software-virtualisierung.de

in 

Cookies make it easier for us to provide you with our services. With the usage of our services you permit us to use cookies.
More information