PowerShell Tip – Unblock Multiple Files in a Directory

Just a quick handy PowerShell command that can come in useful when you are working on a locked down OS Image. We were finding that whenever we copied files from an external source to a local drive they were automatically being blocked by the OS.

You can unblock a single file by using the below PowerShell

Unblock-Files C:\Install\Test.PS1.

Which works fine for an individual file however when you have multiple files or even files inside sub directories that turn into a very long task! To resolve this issue simply run the below:

Get-ChildItem C:\FolderInQuestion\ -recurse | Unblock-File

Hope this Helps!

About the author