Wednesday, February 3, 2016

Powershell command .ps1 cannot be loaded. the file is not digitally signed. you cannot run this script on current system

Recently I came across below error while execute powershell command:

file.ps1 cannot be loaded. The file D:\SIT\deploy\Deploy-SITConnector.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess


Cause:
=====


Generally, you will get this error if you retracted files from compressed format(.zip, .rar) and files are unblocked mode. Selecting individual file of ps1 or other dependent files by going to its properties to unblock will fix the error and you can execute the powershell command.


Solution:
======
- Go to properties of that ps1 file or its dependent files(xml, dll,...) and unblock it.


No comments:

Post a Comment