Use PowerShell to unblock files on Windows

When you save files, such as a PDF or a ZIP file, from a remote location (eg from the internet), Windows tries to protect our machine by blocking it using the Alternate Data Streams (ADS) technology.

To check if a file is blocked, just look at its properties, as shown in the picture below. From here, you can unblock it.

Use PowerShell to unblock files on Windows

This file came from another computer and might be blocked to help protect this computer.

But what if you want to unblock more than one file in one folder? As long as you know that there is no security issue for these files, you can unblock them all with the help of PowerShell.

Unblock files in a folder using PowerShell

Type the following command to unblock all files in a folder by changing the path of the folder to yours.

Get-ChildItem -Path 'C:\Users\Dimitris\Downloads\' | Unblock-File

Or for a shortcut, try the following.

gci 'C:\Users\Dimitris\Downloads \' | Unblock-File

If you want to unblock all files that exist in the sub-folders as well, just add the -Recurse switch.

Get-ChildItem -Path 'C:\Users\Dimitris\Downloads\' -Recurse | Unblock-File

More about Unblock-File.

About Dimitris Tonias 143 Articles
My name is Dimitris Tonias, IT Pro, G(r)eek, focused on Server, Virtualization, and Cloud technologies.

Be the first to comment

Leave a Reply

Your email address will not be published.