• Login
  • Register

Community Dashboard

Our community dashboard tracks activity and engagement from community members across a wide variety of sources, including, the DNN forum, Twitter, GitHub, StackOverflow, etc.
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 31 Jan 2022 11:11 AM by  Mawadda Abuhamda
Running a PowerShell script that isn’t digitally signed
 0 Replies
You are not authorized to post a reply.
Author Messages

New Member

New Member

31 Jan 2022 11:11 AM
    To run a PowerShell script that isn’t digitally signed, you could change your execution policy.
    You can do this by first running “Get-ExecutionPolicy cmdlet” to get to your execution policy. Then you can run “PS C:> Set-ExecutionPolicy unrestricted,” which will change your execution policy to unrestricted. This will change the policy for all files and scripts.
    Another way to run an unsigned script that won’t change any settings after you close the current PowerShell session is to run “Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass.” Once you close out of PowerShell, the settings won’t be saved.
    Another way to run the unsigned script is to unblock it. You can unblock it by running “PS C:> Unblock-File -Path C:Downloadsscript1.ps1.”

    Article from https://windowsreport.com...ot-digitally-signed/

    If you have tried to run a PowerShell script that isn’t signed, you’ve likely stumbled upon the following error <PowerShell Script file> is not digitally signed. You cannot run this script on the current system.
    Windows PowerShell is a shell initially developed by Microsoft for the purposes of task automation and configuration management. There’s no wonder that its Execution Policy is set to Restricted, which protects from running malicious scripts.
    However, this security error can occur when the PowerShell Execution Policy is set to AllSigned or RemoteSigned and the script isn’t signed. If you’d like to sign the script and solve this, here are a few methods that may help.
    What can I do if PowerShell is not digitally signed?
    1. Check and change Execution Policy
    Execution Policy
    Let’s take a look at how to check the Execution Policy, as well as how this can be used to get rid of your error. First of all, you may run Get-ExecutionPolicy cmdlet to get your Execution Policy. The list parameter in the Get-ExecutionPolicy cmdlet tells you the policy for each scope.
    At this point, a convenient method is to change the Execution Policy using the SetExecutionPolicy cmdlet. The following command sets the execution policy to Unrestricted: PS C:> Set-ExecutionPolicy unrestricted. Press Y to confirm the change when prompted.
    The policy change is updated in the registry and remains this way, at least until you change it again. Note that Unrestricted means loading absolutely all configuration files and running all scripts. If you run an unsigned script that was downloaded from the Internet, you are though prompted for permission before it runs.

    2. Bypass the current PowerShell session
    bypass PowerShell session
    Another quick fix is to run Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass. This simple command above will set the execution policy to bypass the current PowerShell session.
    Even better, once you close this PowerShell session, these settings will be lost.

    3. Unblock the file that was downloaded
    use the Unblock-File cmdlet
    When the Execution Policy is RemoteSigned, this requires that all scripts and configuration files downloaded from the Internet or from emails are signed by a trusted publisher.
    If you trust the contents of the script are safe, then you can unblock it to run on your session using the Unblock-File cmdlet: PS C:> Unblock-File -Path C:Downloadsscript1.ps1.
    If you have any questions about these fixes for the encountered PowerShell error, leave us a message in the comments section below. We’ll do our best to assist you.
    You are not authorized to post a reply.