title: Why is my locally-created script not allowed to run under the RemoteSigned execution policy?
body: <blockquote>
    <p>Since this question continues to attract responses that are either
    refuted by the question body or don't address the actual problem,
    <strong>please read this simple summary</strong> of what you need to know:</p>
    
    <ul>
    <li><strong>This is <em>not</em> a "Why won't my default installation of PowerShell run scripts?" question.</strong></li>
    <li><strong>This is <em>not</em> a "Why won't my installation of PowerShell run scripts downloaded from the internet?" question.</strong></li>
    <li><strong>The question is why the <code>RemoteSigned</code> execution policy is preventing script execution when it shouldn't.</strong></li>
    <li><strong><code>RemoteSigned</code> is the <em>only</em> execution policy I want to use.</strong>  I am aware that other, less-restrictive policies are available.  If
    those policies were acceptable substitutes I would have just used them
    instead and this question wouldn't exist.</li>
    <li><strong>The execution policy is <em>already</em> set to <code>RemoteSigned</code>.</strong>  Changing it from <code>RemoteSigned</code> to <code>RemoteSigned</code> is not a solution.</li>
    <li><strong>The script file is created and stored locally.</strong></li>
    <li><strong>The script file is not blocked.</strong>  The script file was never blocked (see previous point).</li>
    <li><strong>The script file cannot be unblocked</strong> because there is nothing to unblock  (see previous point).</li>
    <li><strong>The script file is (attempted to be) executed by an administrator.</strong></li>
    <li><strong><code>Windows PowerShell</code> is the only application involved.</strong>  Not <code>Windows PowerShell ISE</code> nor <code>Command Prompt</code> nor any other tools or
    editors are relevant.</li>
    <li><strong>The cause of the problem has <em>already</em> been identified</strong> (see accepted answer).  After nearly 8 years, I think all other obvious
    explanations, whether applicable or not, have been posted, too.  If
    you think otherwise then <strong>please read the question and existing
    answers <em>in their entirety</em> before adding yours.</strong></li>
    </ul>
  </blockquote>
  
  <hr>
  
  <p>I am using Windows PowerShell 2.0 on 64-bit Windows 7 Professional. I have a script on my <code>Desktop</code> that causes the following error when I try to run it:</p>
  
  <pre><code>File C:\Users\UserName\Desktop\Script.ps1 cannot be loaded. The file C:\Users\UserName\Desktop\Script.ps1 is not digitally signed. The script will not execute on the system.  Please see "get-help about_signing" for more details..
  At line:1 char:54
  + C:\Users\UserName\Desktop\TestGetWindowsUpdateLog.ps1 &lt;&lt;&lt;&lt;
      + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
      + FullyQualifiedErrorId : RuntimeException
  </code></pre>
  
  <p>I am both a domain administrator and a local administrator, and if I run <code>Get-ExecutionPolicy -List</code>, I can see that the <code>Group Policy Object</code> I created to configure PowerShell is correctly applying the <code>RemoteSigned</code> execution policy at the machine level:</p>
  
  <pre><code>        Scope ExecutionPolicy
          ----- ---------------
  MachinePolicy    RemoteSigned
     UserPolicy       Undefined
        Process       Undefined
    CurrentUser       Undefined
   LocalMachine       Undefined
  </code></pre>
  
  <p>I created the script myself in <code>Notepad</code>, and used the <a href="https://www.sysinternals.com/" rel="noreferrer">Sysinternals</a>' <a href="https://docs.microsoft.com/sysinternals/downloads/streams" rel="noreferrer"><code>streams</code></a> utility and the file <code>Properties</code> dialog to confirm that the script is not being treated as having come from the internet. If I copy the script to a network share on a domain server, then it's allowed to execute. If I run <code>Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine</code> then the local script is still not allowed to execute, which makes sense since the execution policy at the <code>MachinePolicy</code> scope will take precedence.</p>
  
  <p>As documented by <code>about_Execution_Policies</code>(<a href="https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies" rel="noreferrer">current</a>; <a href="https://technet.microsoft.com/library/dd347641.aspx" rel="noreferrer">at time of question</a>), the <code>RemoteSigned</code> policy means:</p>
  
  <blockquote>
    <ul>
    <li><p>Scripts can run.</p></li>
    <li><p>Requires a digital signature from a trusted publisher on scripts and configuration files that are downloaded from the Internet
    (including e-mail and instant messaging programs).</p></li>
    <li><p>Does not require digital signatures on scripts that you have run and that you have written on the local computer (not downloaded from
    the Internet).</p></li>
    <li><p>Risks running unsigned scripts from sources other than the Internet and signed, but malicious, scripts.</p></li>
    </ul>
  </blockquote>
  
  <p>My script is not signed, but since it is both created and executed locally, it should satisfy the third bullet point above.  Therefore...</p>
  
  <ul>
  <li>Why is my script not being allowed to run?</li>
  <li>Why does PowerShell complain that my script "is not digitally signed" when that requirement should only apply to files from the Internet?</li>
  <li>Why does PowerShell no longer care about the script not being signed when it's run from a network share?</li>
  </ul>