Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Execution Policy Cannot run PowerShell Compact Archive Tool

Nicholas Gautier edited this page Jan 23, 2025 · 6 revisions

Please Read

Starting from version 1.1.0, the PowerShell Compact-Archive Tool will no longer require you to configure your ExecutionPolicy within PowerShell. Instead, use the Bootstrap Loader.bat located in the Windows Start Menu after installation. This will launch the PowerShell Compact-Archive Tool for you without any hassle. As a result, you can skip this tutorial. However, I’m keeping this page available in case it’s needed for specific use cases, or if someone needs to run an earlier version of PSCAT.


ExecutionPolicy Error

To run the PowerShell Compact-Archive Tool, or any PowerShell script for that matter, you must first configure PowerShell to allow unsigned scripts to be executed within the shell's environment. By default, PowerShell will only execute scripts that are signed by a trusted publisher. Microsoft enforces this rule for security reasons - to protect users from potentially malicious scripts that could cause harm to their systems.

While this security measure may seem like an inconvenience, it should be noted that not all users need this functionality. The default setting can help protect less experienced users. However, the downside is that with the default ExecutionPolicy, it is not possible to run the PowerShell Compact-Archive Tool directly. To resolve this, you will need to configure the ExecutionPolicy by using the Set-ExecutionPolicy CMDLet in PowerShell.

Step-By-Step

The instructions below will guide you in configuring the Set-ExecutionPolicy, allowing the PowerShell Compact-Archive Tool to execute on your system. These steps are designed for everyone, regardless of technical experience with PowerShell.

Open PowerShell as an Administrator

In this step, we will launch the PowerShell application with Administrative roles. We will need the Administrative rights as we will configure how PowerShell interacts with scripts, thus configuring the system's settings.

  1. Open the Start Menu

  2. Begin immediately typing "Windows PowerShell"
    Windows Search, Find PowerShell - Click to Enlarge

  3. Select "Run as Administrator" with the PowerShell application highlighted.
    Windows Search, Start PowerShell with Administrative Rights - Click to Enlarge

With this step, we just launched PowerShell with Administrative rights. In the next step, we will configure the Set-ExecutionPolicy.

Configure Execution Policy

In this step, we will configure the Execution Policy by using the Set-ExecutionPolicy CMDLet. By doing this, we will be able to run any script within PowerShell.

  1. Type the following:
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted
    Set the Execution Policy in PowerShell - Click to Enlarge

  2. Accept the risks by typing 'y' and providing the 'Enter' key to confirm.
    Confirmation of setting the Execution Policy - Click to Enlarge

  3. All done!
    Execution Policy Finished - Click to Enlarge

In this last step, we configured PowerShell's Execution Policy such that it is now possible to run any PowerShell based scripts freely within the system.