Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 394
ATur Avatar asked Oct 18 '22 05:10

ATur


1 Answers

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.

like image 75
Backlash52 Avatar answered Oct 21 '22 02:10

Backlash52