Skip to content

Generate Help From Publish-able powershell script #389

Closed
@darksidemilk

Description

@darksidemilk

So say I have a script that I have made publishable, and it's something that doesn't make sense to be its own module. So I've utilized the powershell command New-scriptfileinfo to create the proper headers including a top level help comment block. Then the script also has various functions each with a comment block.
If I try to import the script it runs the script,
Since I am able to add a .link parameter I figure it would be nice to create md files for hosting at the site I put said link.

So in short, Is it possible to use playtps to generate file from a normal ps1 file, or something of that sort.

Here's a little more info with an example.

Here's the heading of a script I use for firstlogoncommands that's launched via an unattend.xml in the oobe phase of sysprep.

<#PSScriptInfo
    .VERSION
        8.1.0
    .GUID
        the-generated-gui-id-goeshere
    .AUTHOR
        JJ Fullmer
    .COMPANYNAME
        My Company
    .COPYRIGHT
        2018
    .TAGS
        Automating-Imaging, IT-2040, sysprep, after-image, oobe, unattend.xml, firstlogon, setup,
        IT-2057, imaging, provisioning, chocolatey
    .LICENSEURI
    .PROJECTURI
        https://InternalKBSite.domain.com/First+Logon+Commands
    .ICONURI
    .EXTERNALMODULEDEPENDENCIES
    .REQUIREDSCRIPTS
        Update-Bootmgr fixwsus cocopuffs
    .EXTERNALSCRIPTDEPENDENCIES
    .RELEASENOTES
        8.1.0
            IT-2040 #comment added error checking with try catch blocks
        8.0.4
            IT-2057 #comment updated firstlogon to use published fixwsus script
            IT-2040 #comment added psrepository configuration at start of script
                also updated userrights script installation to be proper;
        8.0.3
            IT-2040 #comment update to 8.0.3 install the cocopuffs script and run it natively
        8.0.2
            IT-2040 #comment Updated set-bootmgr to use external script
        8.0.1
            * Fixed secondlogon runner as it was only installing it and not setting it to start
        8.0
            * Made Published version
            * Updated second-logon enabler to use published version of second logon scripts
            * Commented out copying itself to c drive
            * Will have to take out references to arrowfs4 share paths as those get published
            * Moved script to _scripts folder
            * Created class for autologon keys instead of storing them in plaintext
#>

<#
    .SYNOPSIS
        Script to run at first logon, is run via the oobe pass of sysprep

    .DESCRIPTION
        This script is started by the oobe pass of sysprep and finishes configuring everything
        It completes configuration of things like
            3of9 barcode font
            provisioning packages
                hide oobe
                certificates
            activates windows
            windows features customization
            setup time server settings
            firewall settings
            add drivers
            install chocolatey
            install fogservice
        Deletes any temporary files
        disables administrator autologon
        sets up schtask for secondlogonscript

    .LINK
         https://InternalKBSite.domain.com/First+Logon+Commands

#>

Then there are various functions defined each with their own help block. Then a main function is called.
Once this script is installed via install-script firstlogoncommands -repository internalRepo it is added to the powershell scripts folder that is added to the PATH the first time a script is installed. So if I run get-help firstlogoncommands it shows the second comment block with the standard help block info.

I'm also wondering if the information such as the release notes, version author, etc. could also be converted to markdown as part of generating the help file.

Thanks,
-JJ

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-MarkdownWriterIssue concerns conversion to markdownResolution-By DesignThe reported behavior is by design.Resolution-ExternalThe issue is caused by external component(s).

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions