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.
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
- 3. Execute get-executionpolicy to see if the change is successful. RemoteSigned indicates success.
- 4. Right-click the powershell script file, select Unlock, and apply