Security Warning when running scripts - Unblock-File not unblocking file

13,853

After searching i found someone with similar issues and it was explained that Classic UNC paths will work without prompting to unblock the file:

\\Servername\Path...

However FQDN paths are not seen as safe by default and will prompt:

\\Servername.foo.local\Path...

My own testing confirms this to be correct as removing the .foo.local from the path causes the Unblock-File prompts to stop.

Share:
13,853
ATur
Author by

ATur

Updated on June 08, 2022

Comments

  • ATur
    ATur almost 2 years

    I suddenly started to recceive this warning when running any script on my computer:

    Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer...

    Screenshot:

    Powershell Security Warning

    The files are not blocked.

    I have

    • checked in File Explorer > Properties.
    • used the Unblock-File cmdlet to unblock as well.
    • checked streams using cmdlet: Get-Content -Path '\\Path\Script.ps1' -Stream Zone.Identifier. No Streams found.
    • used Streams.exe from Sysinternals: streams.exe -d \\Path\Script.ps1. No files with streams found.

    Also tried to remove streams with Powershell:

    Remove-Item -Path \\Path\Script.ps1 -Stream Zone.Identifier
    

    Of course without success as there are no streams.

    Execution policy is Unrestricted.

    When I run Set-ExecutionPolicy Bypass it works without warning. It should, however, also work when it's unrestricted.

    I honestly don't know what's going on.

    • Ansgar Wiechers
      Ansgar Wiechers almost 8 years
      Does the script reside on a network drive?
    • moore1emu
      moore1emu over 5 years
      I know this is old, but this was helpful for me when i had the same problem: blog.netspi.com/…
  • DisplayName
    DisplayName almost 8 years
    he says Execution policy is Unrestricted it means No restrictions; all Windows PowerShell scripts can be run. technet.microsoft.com/en-us/library/ee176961.aspx
  • ATur
    ATur almost 8 years
    Yesterday edited the registry key, but no change. Just tried with the gpedit method, rebooted, but still same issue.
  • ATur
    ATur almost 8 years
    My execution policy is Unrestricted. When changing execution policy to Bypass I don't receive the warning anymore. It should, however, also work when it is Unrestricted.
  • DisplayName
    DisplayName almost 8 years
    so setting execution policy bypass fixed the issue only on current session or all?
  • r007kit
    r007kit over 5 years
    Months of aggravation gone in an instant. You sir are a hero.
  • THE JOATMON
    THE JOATMON over 4 years
    LGPE? Let's Go Pikachu/Eevee?