Get-ChildItem -Path "C:\MyFolder" -Recurse -Include *.ps1, *.psm1, *.exe | Unblock-File PowerShell’s Unblock-File cmdlet, combined with recursive file enumeration, transforms a tedious, error-prone manual task into a one-line, elegant solution. It epitomizes the Unix philosophy of small, focused tools working together, even on Windows. By mastering Get-ChildItem -Recurse -File | Unblock-File , system administrators and power users reclaim their productivity without disabling essential security features. The command respects Windows’ security boundaries while providing an efficient escape hatch for trusted content. In the tug-of-war between safety and agility, PowerShell gives you the rope to tie—or untie—the knot as you see fit.
The core command is simple:
Another practical consideration is handling paths with spaces or special characters. Always quote the root path or use a variable: powershell unblock all files in folder and subfolders
Get-ChildItem -Path "C:\MyFolder" -Recurse -File | Where-Object (Get-Item $_.FullName -Stream Zone.Identifier -ErrorAction SilentlyContinue) | Unblock-File This pattern first filters for files that actually have the Zone.Identifier stream, then pipes only those to Unblock-File , making the operation more deliberate and auditable. Get-ChildItem -Path "C:\MyFolder" -Recurse -Include *