Error executing powershell script: The file was not digitally signed

Solved the error when executing the powershell script: The file \test.ps1 was not digitally signed. The script cannot be run on the current system

Preface

Today I downloaded a PowerShell script from github to run locally. When running, there was a problem that the file was not digitally signed. I will record how to solve it here.
Insert image description here

Solution

  • 1. Reasons

When you first start Windows PowerShell on a computer, the active execution policy is most likely Restricted (the default setting). The Restricted policy does not allow any scripts to run. Need to receive the startup script

  • 2.set-ExecutionPolicy RemoteSigned //Set to open, select Y

Insert image description here

  • 3. Execute get-executionpolicy to see if the change is successful. RemoteSigned indicates success.

Insert image description here

  • 4. Right-click the powershell script file, select Unlock, and apply

Insert image description here

Guess you like

Origin blog.csdn.net/qq_36241539/article/details/118525367