Get-Item .\MyScript.ps1 -Stream * If you see a Zone.Identifier stream, the file is blocked. The Unblock-File cmdlet does exactly what its name suggests: it removes the Mark of the Web and allows PowerShell to trust the file. Basic Syntax Unblock-File -Path <PathToFile> Simple Example # Unblock a single script Unblock-File -Path "C:\Scripts\MyDownloadedScript.ps1" Now you can run it safely .\MyDownloadedScript.ps1 Unblock Multiple Files You can unblock an entire directory of scripts:
Unblock-File -Path .\*.ps1 -WhatIf Output: powershell unblock-file
Unblock-File is your scalpel for precise, safe script execution. The execution policy is a sledgehammer. Use the right tool for the job. For more information, consult the official Microsoft documentation: Get-Help Unblock-File -Online Get-Item