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:
Get-ChildItem -Path "C:\Scripts" -Recurse -File | Unblock-File This command finds all files recursively in C:\Scripts and unblocks them all at once. Because Unblock-File accepts pipeline input, you can combine it with Get-ChildItem or Get-Item :
When PowerShell sees this mark on a script ( .ps1 ), module ( .psm1 ), or configuration file ( .psd1 ), it refuses to execute it by default. This is a , not a bug. It prevents malicious scripts from running automatically.
You can verify if a file is blocked by using Get-Item :