The File PS1 Cannot Be Run Because The File Is Not Digitally Signed

Introduction

If you are getting this error which says .ps1 file cannot be run because the file is not digitally signed. You cannot run this script on the current system

The File PS1 Cannot Be Run Because The File Is Not Digitally Signed

Cause

By default, the command prompts are set to run only the scripts that are digitally signed. Usually, in prod servers this could be the ideal case.

Fix

But in some cases, you may not need digitally signed scripts to execute the standard admin jobs, such as getting the system performance, or generating the M365 services report or running some standard migrations from on-prem to cloud. In this case, you can set the execution policy for current user to unrestricted.

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

The File PS1 Cannot Be Run Because The File Is Not Digitally Signed

After running this command, you should be able to run the unsigned PowerShell scripts for this user.