When you download a file from the Internet like images, documents, etc., they are treated as untrusted files. So if malware is downloaded in form JPEG, it will be able to execute anything on the computer. I am sure you have seen errors where you cannot rename the files or if its document, it remains in read-only mode, and so on. However, it can be annoying if you are downloading a lot of files, and all of them should be unlocked. We have seen how to Unblock a file and how to add Unblock file item to the context menu. In this post, we will share how you can bulk unblock files downloaded from the Internet.
How to find if the file is blocked?
Right-click on any of the files, and select Properties from the context menu. If the file is blocked, then under the General tab, you will have a security warning. It should say
The file came from another computer and might be blocked to help protect this computer and might be blocked to help protect this computer.
You can check the box next to Unblock, and then save the changes to unblock the file. This option is not available when you select multiple files, go to properties.
How does the Unblock-File command work?
PowerShell offers a built-in command — Unblock-File — to change the unblock status of PowerShell script files that were downloaded from the Internet, but it works on all kinds of files. Internally, the Unblock-File cmdlet removes the “Zone.Identifier alternate data stream“. It has a value of “3” to indicate that it was downloaded from the Internet.
If you apply this on PowerShell scripts, it can unblock PowerShell script files that were downloaded from the Internet so you can run them, even when the PowerShell execution policy is RemoteSigned. The syntax for the command is as follows:
Batch Unblock multiple files downloaded from the Internet
The commanded needs single or multiple files. Any output which can pass a list of files to it will work. Here is an example:
- Copy the path where the blocked files are available
- Open PowerShell with admin privileges.
- Type the following and execute
dir <path> | Unblock-File
- The command above uses the DIR command to generate a list of files, and then it is sent to the Unblock-File commandlet.
- You will not receive any kind of confirmation, but all the files will be unblocked.
If you want only to unblock files names of which include e.g., TWC, then the command will be like:
dir <path>\*TWC* | Unblock-File
Those who need to confirm unblocking for files one by one can add -Confirm option along with the command. It will then prompt you for each file. If you choose yes, then it will unblock the file, else will move to the next.
It comes in very handy when you download a file from the Internet, and then share it with somebody else. The data remain locked, and they will be able to rename the file unless it is unlocked. You can use this command to unlock all the files, and then send it.
I hope the post was easy to follow, and you were able to unblock multiple files or bulk files downloaded from the Internet.
- Tags: Files