A tiny PowerShell snippet that removes the “blocked” Mark-of-the-Web (Zone.Identifier) flag from every file inside a folder tree—perfect after unzipping archives downloaded from the internet.
Get-ChildItem -Path "C:\Your\Path\Here" -Recurse -File | Unblock-FileGet-ChildItem -Path "C:\Your\Path\Here" -Recurse -File |
ForEach-Object {
Write-Host "Unblocking $($_.FullName)"
Unblock-File $_
}Replace
C:\Your\Path\Herewith the root folder whose contents you want to unblock.
-
Save either snippet as
unblock-files.ps1. -
Open PowerShell as Administrator (required if any files need elevated rights).
-
Run the script, supplying the target path:
.\unblock-files.ps1 -Path "C:\Users\<YourUser>\Downloads"
Omit the
-Pathparameter if you hard-coded it in the script. -
Watch the progress variant echo each file as it’s unblocked.
Windows tags files from untrusted sources with a hidden Zone.Identifier ADS.
Some executables or scripts refuse to run while this flag is present, and extracting
a large ZIP can leave hundreds of files in this state. These one-liners clear the
flag in one pass instead of using Right-click → Properties → Unblock on each file.
Always scan unfamiliar downloads with your antivirus before unblocking them. Removing the Mark-of-the-Web makes Windows treat the files as local and trusted.