Wednesday, May 31, 2017

Unblocking blocked files

I recently stumbled across a somewhat frustrating feature of Windows 10. With the intent of protecting users from viruses and other malware, any file you download from another computer is by default 'blocked'. The standard way to unblock a file is to right-click on the file you downloaded and check the box next to "Unblock".



This method works great for individual files that you download. However, when a coworker sent me a zip file containing a multi-project Visual Studio Solution via Skype, I discovered that it would extract fewer than a third of the files from the zip file. The extractor would refuse to extract any of the Powershell scripts, BAT files or EXE files contained within the zip file. Since the zip file contained over 1000 files, unblocking them manually would be a trying experience. I needed a neat solution to iterate through all files in the zip and unblock them all.

Powershell came to the rescue. Simply start Powershell as Administrator and enter the following command:

get-childitem "C:\FullFilePathName" -recurse | unblock-file

where C:\FullFilePathName is the full file path name for the zip file you want to unblock.

After running the above command, I was able to extract all of the files and run the Visual Studio solution without issues.

PS: please only use this solution when you know that you can trust the source of the files. 

No comments:

Post a Comment

Resoved: Error Creating Storage Event Trigger in Azure Synapse

My client receives external files from a vendor and wants to ingest them into the Data Lake using the integration pipelines in Synapse (Syna...