Powershell Unblock File May 2026

Here's how to unblock a file in PowerShell: Unblock-File -Path "C:\path\to\file.exe" Method 2: Unblock multiple files Get-ChildItem -Path "C:\folder" -Recurse | Unblock-File Method 3: Unblock specific file types Get-ChildItem -Path "C:\folder" -Filter *.ps1 -Recurse | Unblock-File Method 4: Unblock and run a script Get-ChildItem -Path "C:\scripts" -Recurse | Unblock-File & "C:\scripts\myscript.ps1" Method 5: Unblock files downloaded from internet # Unblock all files in current directory Get-ChildItem | Unblock-File Unblock files in a specific folder Unblock-File -Path "D:\Downloads*" Method 6: Check if file is blocked first Get-Item -Path "C:\file.exe" | Select-Object Name, @Name="Blocked";Expression=$_.PSIsContainer -eq $false -and $_.Streams.Count -gt 0 Note: The Unblock-File cmdlet removes the Zone.Identifier alternate data stream that Windows adds to files downloaded from the internet. You need appropriate permissions to modify files.