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
  • Cmdlets
  • Set-PSPConfiguration
  • Get-PSPConfiguration
  • Test-PSPConfiguration
  • Save-PSPConfiguration
  • ProgramData File
  • Registry
  • Registry Configuration File
  • Registry Configuration Path
  • Precedence
  1. PowerShell Pro Tools Documentation
  2. PowerShell Protect

Configuration

Configuration of PowerShell Protect is done using XML. You can create the XML file in the following locations.

Cmdlets

You can use the configuration cmdlets to get, set and test your Protect configurations.

Set-PSPConfiguration

To set a configuration for the local machine, you can use Set-PSPConfiguration. You will need to provide a path to a Protect configuration file and then the destination of the configuration.

The below will install the configuration file into the file system location.

Set-PSPConfiguration -ConfigurationFilePath .\config.xml -FileSystem

The below will install the configuration file into the registry.

Set-PSPConfiguration -ConfigurationFilePath .\config.xml -Registry

You can also pass a Configuration object created with New-PSPConfiguration to Set-PSPConfiguration.

$Config = New-PSPConfiguration #options
Set-PSPConfiguration -Configuration $Config -Registry

Get-PSPConfiguration

To return the current Protect configuration, use Get-PSPConfiguration. You will receive a configuration object or null if no configuration is installed.

Get-PSPConfiguration

Rules         Actions
-----         -------
{Web Request} {File, Block}

Test-PSPConfiguration

To test a configuration file before installing it, you can use Test-PSPConfiguration. This cmdlet will use the specified configuration file and evaluate the provided script block. The Test-PSPConfiguration cmdlet will return either Ok if the script will not be blocked and AdminBlock if the script will be blocked. Other actions, such as TCP or HTTP, will also be executed.

Test-PSPConfiguration -ConfigurationPath ".\config.xml" -ScriptBlock { Invoke-WebRequest }
AdminBlock

Save-PSPConfiguration

This cmdlet is used to save configuration files to disk. Specify the Configuration object and path.

$Config = New-PSPConfiguration #options
Save-PSPConfiguration -Configuration $Config -Path .\myconfig.xml

ProgramData File

You can create an XML file in %ProgramData%\PowerShellProtect\config.xml . You will need to set the proper permissions so the XML file is readonly. Any changes made to the XML file will automatically be reloaded by PowerShell Protect.

Registry

Registry Configuration File

You can create an XML document and store it in the registry key HKLM\Software\Ironman Software\PowerShell Protect in the value Configuration.

Registry Configuration Path

You can also specify the path to an XML document by creating the registry key HKLM\Software\Ironman Software\PowerShell Protect and setting the value ConfigurationFile . This needs to be the full path to the file. Environment variables will be expanded.

Precedence

Configuration methods are loaded by precedence. Options higher in the precedence will be checked first. If a configuration file exists in that location, it will be loaded first and the subsequent locations will not be loaded.

  1. Registry Configuration File

  2. Registry Configuration Path

  3. ProgramData File

PreviousRulesNextPSCommander

Last updated 3 years ago