Get-childitem -path . -recurse | Unblock-file
| Error | Cause | Solution | |-------|-------|----------| | Access to the path is denied | File permissions or open handle | Run PowerShell as admin; close file in other apps | | Cannot find path ... Zone.Identifier | File not blocked (normal) | Ignore (not an actual error) | | The path is not of a legal form | Corrupted file name or path | Use -LiteralPath instead of -Path | | Get-ChildItem : Access denied | Cannot traverse a subdirectory | Add -ErrorAction SilentlyContinue or run as admin |
Get-ChildItem -Path . -Recurse -Directory -Exclude "Windows","System32" | ForEach-Object Get-ChildItem $_.FullName -File
: While Unblock-File will only act on files (and silently ignore directories), it's still worth noting that it doesn't differentiate between files based on their type or content. It will attempt to unblock all files. get-childitem -path . -recurse | unblock-file
No output → all files unblocked successfully.
: This takes the file objects gathered by the first command and passes them directly to the next. | Error | Cause | Solution | |-------|-------|----------|
Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 3/12/2025 10:15 AM 12345 script.ps1 -a--- 3/10/2025 8:30 AM 8900 report.pdf d---- 3/14/2025 2:00 PM subfolder
: This parameter tells Get-ChildItem to look not just in the current directory but also in all its subdirectories. It will attempt to unblock all files
On Linux/macOS, the command does nothing (Zone.Identifier is Windows-specific).