Powershell packages, repositories and GUI apps

This article discusses Powershell packages, repositories and GUI apps. A common question which comes up around Microsoft Powershell is how to make use of the Powershell artifacts, including the following:

  1. functions
  2. snap-ins
  3. modules
  4. DSC Resources
  5. role capabilities
  6. scripts
  7. packages

Powershell packages

In order to manage Powershell packages, the following Microsoft Powershell resource can be used as reference: https://docs.microsoft.com/en-us/powershell/module/packagemanagement/?view=powershell-6. The two cmdlets to run initially are the find-package and find-packageprovider cmdlets.

Also the Get-Help cmdlet should be run in order to download all script-related documentation for powershell packages.

Some of the most commonly used Powershell packages nuget, chocolatey and PowershellGet.

There are a lot of useful Powershell repositories in the public Internet. One good example is the Powershell Gallery. Setting up your own Powershell internal repository inside your organization is also easy (instead of setting up a full nuget server). Step-by-step instructions can be found at: https://kevinmarquette.github.io/2017-05-30-Powershell-your-first-PSScript-repository/ .

Windows GUI Powershell applications

Now when it comes to putting all the above Powershell artifacts to work, from a practical point of view sometimes it is useful to create a GUI app without coding and at the same time wrap that GUI app into a standalone executable (.exe file) which can run on any Windows system. A solution for this can come from the combined use of the following free public services:

  1. PoshGUI. Using this service you can rapidly create the GUI elements of a Powershell script and copy the GUI-related code to further be populated with GUI control events and properties logic.
  2. PS2EXE. The output code from the PoshGUI service needs to be finalized with GUI control events and properties code as well as with additional business logic code as required. Then the final .ps1 file can be converted to .exe using this Ps2EXE service. The bundled download of PS2EXE includes a usage file with instructions on how to build an .exe from an existing .ps1 file: https://www.powershellgallery.com/packages/ps2exe/1.0.4.