Unblock downloaded files

In the process of downloading a file from an insecure location Windows blocks the file.

I have had this bothering to often.  For example when I downloaded an add-in and hit an error.

And more recently I downloaded a knowledge base packed and installed with my PowerShell script just to find out that every file in the download had been blocked.

Once again, PowerShell came to the rescue.  Opened Windows PowerShell ISE in Administration Mode and execute the below script for the needed folders.

[code lang=”ps”]$folder = ‘C:\PUB’
#$folder = ‘C:\Program Files\Microsoft Dynamics NAV’
#$folder = ‘C:\Program Files (x86)\Microsoft Dynamics NAV’
$files = Get-ChildItem -Path $folder -Recurse
foreach ($file in $files)
Write-Host "Unblocking file $file…"
Unblock-File -Path $file.FullName

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.