Ignore 'Security Warning' running script from command line Ignore 'Security Warning' running script from command line powershell powershell

Ignore 'Security Warning' running script from command line


This is touched in "PowerShell Execution Policies in Standard Images" on Lee Holmes' Blog and "PowerShell’s Security Guiding Principles" on the Windows Power Shell Blog.

SummarySome machines treat UNC paths as the big bad internet, so PowerShell treats them as remote files. You can either disable this feature on those servers (UncAsIntranet = 0,) or add the remote machines to your trusted hosts.

If you want to do neither, PowerShell v2 supports an -ExecutionPolicy parameter that does exactly what your pseudocode wants. PowerShell -ExecutionPolicy Bypass -File (...).


To avoid warnings, you can:

Set-ExecutionPolicy bypass


If you're running into this error from a downloaded powershell script, you can unblock the script this way:

  1. Right-click on the .ps1 file in question, and select Properties

  2. Click Unblock in the file properties

    enter image description here

  3. Click OK