PowerShell Pro Tools
Ironman SoftwareGitHub
  • About
  • System Requirements
  • PowerShell Tools Documentation
    • Visual Studio
      • Analysis
      • Debugging
        • Local Debugging
        • Remote Debugging
      • Format Document
      • Go to Definition
      • Packaging in Visual Studio
      • PowerShell 7 Support
      • PowerShell Interactive Window
      • Project System
        • Advanced
        • Debug
        • Build Events
      • Settings
        • General
        • .editorconfig
        • Analysis
        • Diagnostics
      • Tool Windows
      • Refactoring
      • Unit Test Adapter
      • User Interface Design
        • Windows Forms
  • PowerShell Pro Tools Documentation
    • Visual Studio Code
      • Automating Visual Studio Code
      • Code Conversion
      • Debugging
        • Run in New Terminal
        • One-Click Attach
      • Decompiler
      • Diagnostics
      • Enhanced Hover
      • Generating a UI from a function
      • Generate a Tool from a Function
      • Packaging in Visual Studio Code
      • Pin Session
      • PowerShell Explorer
      • Profiler
      • Sign On Save
      • RapidSense
      • Refactoring
      • Rename Symbols
      • Quick Scripts
      • Windows Forms Designer
    • Installers
    • Packaging
      • Package.psd1
      • PowerShell Packager
      • Package Hosts
      • Package as Service
      • Packaging on Linux
      • Packaging on Mac OS X
      • Continuous Integration
      • Anti-Virus
    • PowerShell Module
      • Global Hotkeys
      • Show-PSEditor
      • Show-PSScriptPad
      • Show-TUIDesigner
      • ConvertTo-CSharp
      • ConvertTo-PowerShell
      • Merge-Script
      • Install-PoshProToolsLicense
      • about_MergeScriptConfig
      • Show-WinFormDesigner
    • PowerShell Protect
      • Getting Started
      • Installation
      • Actions
      • Rules
      • Configuration
    • PSCommander
    • PSScriptPad
    • Installation and Licensing
      • Visual Studio Offline Installation
  • Changelog
    • PowerShell Tools for Visual Studio
    • PowerShell Pro Tools for Visual Studio Code
    • PowerShell Packager
    • PSScriptPad
    • PowerShell Pro Tools Module
Powered by GitBook
On this page
  • Requirements:
  • Bundling
  • Packaging as an Executable
  • Obfuscation
  • Anti-Virus
  • NuGet
  1. PowerShell Pro Tools Documentation

Packaging

PreviousInstallersNextPackage.psd1

Last updated 9 months ago

Requirements:

  • Internet Connection

The packaging component of PowerShell Pro Tools allows you to bundle, package as an executable and obfuscate the resulting executable.

Bundling

The process of bundling takes multiple scripts and creates a single script. Bundling automatically follows dot sourced scripts and includes them in the final output script. This process is recursive and will include scripts that are included by other scripts. Take for example you have three scripts. The first script looks like this.

Write-Host "Hi! I'm script 1"

. $PSScriptRoot\Script2.ps1

Script1.ps1 outputs “Hi! I’m script 1” and then calls Script2.ps1 found at the $PSScriptRoot. Script2.ps1 could then look like this.

`Write-Host "Hi! I'm script 2"

.\Script3.ps1`

Script2.ps2 outputs “Hi! I’m script 2” and the calls Script3.ps1. Script3.ps1 could consist of something like this.

Write-Host "Hi! I'm script 3"

If you wanted to deploy these scripts to an environment, you’d need to make sure to copy each script. Using bundling, you could combine the scripts, automatically, into a single script. The resulting script would look like this.

`Write-Host "Hi! I'm script 1"

Write-Host "Hi! I'm script 2"

Write-Host "Hi! I'm script 3"`

This enables developers to organize their code into multiple scripts but then deploy a single script. You could store all three scripts in source control, such as GitHub, and then run a bundling step using a continuous integration system, such as AppVeyor.

Packaging as an Executable

Scripts can be packaged as a .NET executable for easy deployment on any Windows system. You can combine bundling with packaging to include multiple scripts into a single executable.

Obfuscation

Once scripts have been packaged as a .NET executable, you can take an additional step and obfuscate the executable (this feature is limited to Windows PowerShell only). This will make it much more difficult for users to decompile your executable and inspect your PowerShell script. Obfuscated assemblies scramble the C# code as well as the PowerShell script.

You can obfuscate executables with PowerShell Pro tools using Visual Studio, Visual Studio Code and Merge-Script.

Anti-Virus

NuGet

We use the Microsoft NuGet.org package system to download the packages necessary to host PowerShell in .NET. You will need an internet connection to access NuGet.org.

By default, you should have the package source defined. If you do not, you can do so with the following dotnet command line.

dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

You can bundle scripts with PowerShell Pro tools using or .

You can package scripts with PowerShell Pro tools using or .

Anti-Virus vendors may flag executables as malicious after they have been compiled. You can use to verify which vendors may flag your executable. If you need to submit a executable for evaluation, you can use the below list of vendor verification processes.

Learn more about issues with .

For offline builds, you can also host your .

.NET Core 3.1 SDK or Later
.NET 5.0 SDK for Packaging PowerShell 7.1
.NET 4.6.2 Developer Pack
Visual Studio
Merge-Script
Visual Studio
Merge-Script
VirusTotal
Microsoft Defender
anti-virus here
own NuGet feed