簡體   English   中英

Powershell 網絡驅動器上的腳本即使在運行 Unblock-File 后仍然給出安全提示

[英]Powershell script on network drive still giving security prompt even after running Unblock-File

我正在嘗試運行我編寫的 Powershell Cmdlet。

它存儲在映射到Z:\...的網絡驅動器上。

我在管理員模式下啟動了 Powershell 並將執行策略設置為Unrestricted

我已經在我的 Cmdlet 及其調用的每個腳本上運行了Unblock-File

我使用絕對路徑或以.\開頭的相對路徑調用我的 Cmdlet。

但是,制表符補全對我的 Cmdlet 的參數不起作用,我仍然收到此安全警告:

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script
can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to
allow the script to run without this warning message. Do you want to run <file-name>?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”):

我究竟做錯了什么?

就我而言,答案是 Windows 配置為將 .network 驅動器視為公共 inte.net 上的一個位置。

解決方案是啟動Inte.net 選項控制面板,導航到安全選項卡,並將我的腳本所在的 .network 共享(例如\.networkshare )添加到Local intr.net安全區域。

之后,制表符補全與我的 Cmdlet 的參數一起正常工作,並且腳本可以在沒有任何安全警告的情況下執行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM