What is a blocked file and how do I unblock it?

When you download or copy a file from the internet or any other untrusted source, Windows will set an extended attribute to mark the file as “blocked”. This is an important mechanism that stops the execution of potentially malicious code. This mechanism not only applies to scripts and executable files, it also applies to dlls and Office documents. Documents can contain macros and scripts which execute when a document is opened, edited, or printed.

Once you have verified that a file is benign and ok, it is fairly easy to remove the blocked attribute.

In the PrimalScript and SAPIEN Script Explorer File Browser, you can right-click on a file marked as blocked and unblock it. It’s easy to see blocked files indicated by a yellow lock icon.


Sometimes you want to open a file that is blocked. In most other applications, you have to exhale slowly, close the file, switch over to Windows File Explorer, find the file, right-click, select “Properties”, and then unblock the file. Then you can open it again and actually edit the content.


Fortunately, in PrimalScript and in PowerShell Studio, you can simply right-click on the document tab in the Editor and unblock the file. There is no need to close and re-open it.

PrimalScript context menu

PowerShell Studio context menu

In addition to other helpful indicators, PowerShell Studio will also put a corresponding message in the Output panel when you open a blocked file.


Last but not least, blocked files can be annoying, especially if there is more than one. There are scripts published that summarily remove the block on all files in a sub-folder; please do not do that. Blocked files are a security mechanism intended to alert you to files that potentially contain malicious elements. By removing this warning without checking, you open yourself up to serious risk.

I understand that it is cumbersome and time-consuming to go file-by-file, but it takes far longer to remove malware or ransomware from your machine or your entire network.

So when you download files, always double-check before unblocking.