Blocked PowerShell Script Execution – File Not Signed

There’s times when you need to run an unsigned PowerShell script on Windows Server for convenience, for example when you pull it down from online.

A word of warning – obviously – you need to know what any script does before you ever execute it – especially with privilege.

Now, instead of changing the Server’s script Execution Policy using the Set-ExecutionPolicy PS command, it turns out you can add a file exception without having to do so.

A best practice is to read the script’s code and verify it’s safe before using the Unblock-File cmdlet. The Unblock-File cmdlet unblocks scripts so they can run, but doesn’t change the execution policy.

The syntax of the command is:

PS> Unblock-File –Path <path>\<script name>.ps1

I picked this up from a Microsoft Docs site.

About Rob Sanders

IT Professional and TOGAF 9 certified Enterprise Architect with nearly two decades of industry experience, 18 years in commercial software development and 11 years in IT consulting. Check out the "About Rob" page for more information.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.