Wednesday, January 22, 2014

PowerShell Script is not digitally signed. The script will not execute on the system.

שלום חברים,

היום ניסתי להריץ פקודה ב-PowerShell וקיבלתי את השגיאה הבאה :

"…. The file C:\Program Files\Common Files\Microsoft shared\Web Server Extensions\15\CONFIG\POWERSHELL\Types\Lapointe.SharePoint.PowerShell.Cmdlets.Types.ps1xml   is not digitally signed. The script will not execute on the system. For more information, See about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID =135170. "


אחרי עיון הבנתי שיש איזושהי מדיניות בשרת שחוסמת את ההרצה. הרצתי את הפקודה הבאה (ב-Console ManagementShell).

קבלת מדיניות :
Get-ExecutionPolicy –list

וראיתי של-User  הנוכחי מוצגת מדיניות אשר מגבילה אותו להריץ Scriptים בתחנה, המדיניות שהייתה לו היא AllSigned שהמשמעות שלה היא :
 " Only scripts signed by a trusted publisher can be run" .


הפתרון שלי היה לשנות את המדיניות למשתמש איתו אני מנסה להריץ את ה-Script ל - Remote Signed  ,כלומר :
 "Downloaded scripts must be signed by a trusted publisher before they can be run"
מדיניות שמאפשר למשתמש להריץ Script אלא אם כן זהו Script שהורד מהרשת.


שינוי המדיניות :
Set-ExecutionPolicy "RemoteSigned" -Scope Process -Confirm:$false
Set-ExecutionPolicy "RemoteSigned" -Scope CurrentUser -Confirm:$false

עכשיו אני מצליח להריץ את ה-Script .

בהצלחה!
רון נס

============================================================================================================================================================================================================================================================


Hello Friends,

Today I tried to run a command in PowerShell and I got the following error:

"…. The file C:\Program Files\Common Files\Microsoft shared\Web Server Extensions\15\CONFIG\POWERSHELL\Types\Lapointe.SharePoint.PowerShell.Cmdlets.Types.ps1xml   is not digitally signed. The script will not execute on the system. For more information, See about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID =135170. "


After the while I realized that some server policy blocks the run. I ran the following command (in Console ManagementShell(.

Get  the policy:
Get-ExecutionPolicy –list


I saw that the current User has a policy that restricts run Script in the station, it is a policy that was AllSigned It means:

" Only scripts signed by a trusted publisher can be run" .


My solution was to change the user policy to Remote Signed, namely:

"Downloaded scripts must be signed by a trusted publisher before they can be run"

This Policy enables users to run Scripts unless this is Script downloaded from the network.


Change in policy:
Set-ExecutionPolicy "RemoteSigned"-Scope Process-Confirm: $ false
Set-ExecutionPolicy "RemoteSigned"-Scope CurrentUser-Confirm: $ false

Now I can run the script.

Good Luck :)
Ron Ness

No comments:

Post a Comment