Font size: +
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

Downloads:

zipPowerShellBooksGenerator HOT

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

...
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 264
License Nick Informationstechnik Tool LicenceTooltip
Price

Some Examples

pdfPowershell_With_AppVClient HOT

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 6,685
License
Price

pdfPowershell_With_AppVSequencer HOT

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 3,919
License
Price

pdfPowershell_With_AppVServer HOT

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 1,735
License
Price

pdfPowershell_With_AppX HOT

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 2,288
License
Price

pdfPowerShell_With_BranchCache HOT

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 3,602
License
Price

pdfPowershell_With_Dism HOT

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 4,262
License
Price

pdfPowershell_With_ActiveDirectory HOT

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 2,073
License
Price

pdfPowershell_With_DnsServer HOT

Powershell_With_DnsServer

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

pdfPowershell_With_PrintManagement HOT

Created with the PowerShell Book Generator

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

pdfPowershell_With_Storage HOT

Created with the PowerShell Book Generator

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

pdfPowershell_With_UEV HOT

Created with the PowerShell Book Generator

Information
Created 02.02.2020 20:32:19
Changed 02.02.2020 20:32:19
Version
Size 201.99 KB
Created by Andreas Nick
Changed by
Downloads 7,059
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, February 07, 2020 18:46

Is the source in a GitHub repo somewhere?

Is the source in a GitHub repo somewhere?
Andreas Nick on Friday, February 07, 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, February 05, 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, February 03, 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, February 06, 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
Saturday, December 21, 2024

Captcha Image

@nickinformation Tweets

My german Blog: 

http://www.software-virtualisierung.de

in 

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.