PowerShell Universal GitHub Templates

PowerShell Universal

January 17, 2023

quote Discuss this Article

PowerShell Universal Templates

PowerShell Universal Templates are packages of PowerShell scripts, along with other resources, that can be applied to your environment to automatically enable functionality built by other users. Templates can include features such as custom API endpoints, scripts, and even full dashboards. Templates help accelerate development by providing complete solutions or examples you can use to get started.

Templates have been a little difficult to create and require a running PowerShell Universal instance to properly generate. We’re changing this by adjusting how templates are submitted to the Ironman Software website. Rather than having to create a .psupkg file directly, you can now publish a GitHub repository to the template library. We’re also providing a GitHub template repository to get you started. This should make it much easier to generate templates and update them on our website.

Templates show up on IronmanSoftware.com as well as within PowerShell Universal in the Templates page.

An Example: Database Explorer

We’ve put together a very simple example of a GitHub-based template repository. It’s based on our GitHub template repository so you can see how it works.

The database explorer uses dbatools to read information about a SQL Server’s databases, tables, users, views and table data.

The repository can be found here. The resulting template can be found here.

A Walkthrough

Creating your own template repository requires just a few steps. First, you will want to create a GitHub repository based on our template. Click here to view the template repository.

Next, click the Use this template drop down and select Create a new Repository. You can name your repository whatever you like.

The new repository will contain the basic requirements for publishing a template to our website. Next, you’ll want to login to IronmanSoftware.com. From your account page, you should click Templates to get your publish token. This token verifies who the user is that is publishing the template and will ensure that it’s tied to your account.

You will now need to set the token as a secret in your GitHub repository. Click Settings \ Secrets and variables \ Actions and New repository secret. Create a secret named TOKEN with the token value.

Now you can clone your repository locally and add your files. This can be any configuration files you see fit. Make sure not to include your license file. Any license file included in a template repository will be invalidated and will no longer work properly.

We recommend updating the README.md file to include information about your template. Any images you include will be shown on our website.

Finally, update your manifest.json with information about your template.

{
    "description": "View databases, tables, users and data in your MS SQL server.",
    "name": "Database Explorer",
    "version": "1.0.0"
}

Once you are satisfied with your template, commit and push it to your GitHub repository. Templates will not automatically push to IronmanSoftware.com. In order to publish, you will need to Click Actions \ Publish and Run Workflow to send it over to the centralized template repository.

Whenever you make changes to your template, you will want to update the version number in the manifest.json file and publish it again. The newer version will be the version that folks download in PowerShell Universal. Previous versions are still available in the version list.

Feedback

Please let us know about the new GitHub-based template feature. We hope this makes it easier to contribute funcitonality to other PowerShell Universal users. We will be starting to roll out new templates over the next few weeks based on this functionality. PowerShell Universal v4 will feature a new plugin model that makes it easier to install and uninstall templates such as this. Stay tuned for beta releases.