title: How to force Powershell set ERRORLEVEL variable after ExecutionPolicy error
body: <p>Powershell does not set ERRORLEVEL variable on an ExecutionPolicy error.<br>
  So how can one determine in batch code that the script has failed?</p>
  
  <pre><code>C:\Windows\system32&gt;powershell -File myScript.ps1  
  Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.  
  File myScript.ps1 cannot be loaded. The file myScript.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.
  + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
  + FullyQualifiedErrorId : UnauthorizedAccess
  
  C:\Windows\system32&gt;echo %ERRORLEVEL%  
  0
  </code></pre>