gpt4 book ai didi

运行脚本时的安全警告 - Unblock-File not unblocking file

转载 作者:行者123 更新时间:2023-12-02 22:40:15 26 4
gpt4 key购买 nike

在我的计算机上运行任何脚本时,我突然开始收到此警告:

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



截屏:

Powershell Security Warning

文件没有被阻止。

我有
  • 在文件资源管理器 > 属性中检查。
  • 也使用 Unblock-File cmdlet 解除阻塞。
  • 使用 cmdlet 检查流: Get-Content -Path '\\Path\Script.ps1' -Stream Zone.Identifier 。未找到流。
  • 使用了来自 Sysinternals 的 Streams.exe: streams.exe -d \\Path\Script.ps1 。未找到包含流的文件。

  • 还尝试使用 Powershell 删除流:
    Remove-Item -Path \\Path\Script.ps1 -Stream Zone.Identifier

    当然没有成功,因为没有流。

    执行政策不受限制。

    当我运行 Set-ExecutionPolicy Bypass 时,它可以在没有警告的情况下工作。
    但是,它也应该在不受限制的情况下工作。

    老实说,我不知道发生了什么。

    最佳答案

    搜索后,我发现有人有类似问题,并解释说经典 UNC 路径可以在不提示取消阻止文件的情况下工作:

    \\Servername\Path...

    但是,默认情况下 FQDN 路径不被视为安全,并且会提示:
    \\Servername.foo.local\Path...

    我自己的测试证实这是正确的,因为从路径中删除 .foo.local 会导致 Unblock-File 提示停止。

    关于运行脚本时的安全警告 - Unblock-File not unblocking file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38584428/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com