• Contact
  • Homelab
Dimitris Tonias
  • Management
  • Monitoring
  • Cloud
  • Virtualization
  • Networking
  • Productivity
No Result
View All Result
  • Management
  • Monitoring
  • Cloud
  • Virtualization
  • Networking
  • Productivity
No Result
View All Result
Dimitris Tonias
No Result
View All Result

Use PowerShell to unblock files on Windows

Dimitris Tonias by Dimitris Tonias
December 19, 2017 - Updated on April 21, 2024
in Management
Reading Time: 1 min read
A A
8
Share on FacebookShare on Twitter

When you save files, such as a PDF or a ZIP file, from a remote location (eg from the internet), Windows tries to protect our machine by blocking it using the Alternate Data Streams (ADS) technology.

To check if a file is blocked, just look at its properties, as shown in the picture below. From here, you can unblock it.

Use PowerShell to unblock files on Windows

This file came from another computer and might be blocked to help protect this computer.

But what if you want to unblock more than one file in one folder? As long as you know that there is no security issue for these files, you can unblock them all with the help of PowerShell.

Unblock files in a folder using PowerShell

Type the following command to unblock all files in a folder by changing the path of the folder to yours.

Get-ChildItem -Path 'C:\Users\Dimitris\Downloads\' | Unblock-File

Get-ChildItem -Path 'C:\Users\Dimitris\Downloads\' | Unblock-File

Or for a shortcut, try the following.

gci 'C:\Users\Dimitris\Downloads \' | Unblock-File

gci 'C:\Users\Dimitris\Downloads \' | Unblock-File

If you want to unblock all files that exist in the sub-folders as well, just add the -Recurse switch.

Get-ChildItem -Path 'C:\Users\Dimitris\Downloads\' -Recurse | Unblock-File

Get-ChildItem -Path 'C:\Users\Dimitris\Downloads\' -Recurse | Unblock-File

More about Unblock-File.

Tags: File ExplorerPowerShell
ShareTweetPin
Previous Post

Install .NET Framework 3.5 on Windows Server 2016

Next Post

Add computers to TrustedHosts list using PowerShell

Related Posts

Approve updates in WSUS 2016
Management

Approve updates in WSUS 2016

Configure Group Policy to deploy updates using WSUS 2016
Management

Configure Group Policy to deploy updates using WSUS 2016

Configure computer groups in WSUS 2016
Management

Configure computer groups in WSUS 2016

The initial configuration of WSUS 2016
Management

The initial configuration of WSUS 2016

Install WSUS in Windows Server 2016
Management

Install WSUS in Windows Server 2016

Error opening Report Viewer on WSUS 2016
Management

Error opening Report Viewer on WSUS 2016

Comments 8

  1. Pad says:
    6 years ago

    Thank you very much!

    Reply
  2. Daniel says:
    6 years ago

    Works, thank you.

    Reply
  3. Paul G says:
    6 years ago

    Very helpful. Thank you.

    I have one question. Is there a way to list the files that need unblocking? This way I can review that list first.

    Reply
    • Dimitris Tonias says:
      6 years ago

      You can use PowerShell to get all these files for review. For example, running the following command you will get the list of all files that needs unblocking. Zone identifier stores whether the file was downloaded from the internet.

      Get-Item * -Stream "Zone.Identifier" -ErrorAction SilentlyContinue

      Reply
      • Darrell Bunger says:
        2 months ago

        Perfecto, thank you for this information of how to find files blocked that need unblocked using zone.identifier property in the file stream! I already knew the magic unblock phrase, I needed the “which files need unblocked” phrase. I know it seems a bit redundant and if you’re unblocking why not just run the command to unblock, but I needed a test of if it was done or not, and this should be it with a little adjustment knowing it’s the Stream property “Zone.Identifier” with errors that identify. I’m sure there are different kinds of errors but just knowing that there are errors is miles beyond where I was.

        Thanks again!

        Reply
  4. Sam Thackeray says:
    5 years ago

    Any suggestions on how to do this for files with a path exceeding the 260 character limit?

    Thanks

    Reply
    • Darrell Bunger says:
      2 months ago

      Sam,

      I know that’s an old post and probably beyond your needs now, but hey. In case you still are wondering, there is a 32-bit file system dll that you can search and find on the internet and hack into the registry so the file system will work at longer bit lengths. Pretty sure one of the older Windows 10 updates phased that out though, should just be able to mod the character lengths in registry or GPO now.

      Reply
  5. Kris Turner says:
    4 years ago

    I know this is an old post but it just helped me a lot today. 45 years old and I learned something new. Just saved me time cause I just unzipped a 3 gb file I forgot to unblock before. Thanks!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result
Zabbix server: More than 75% used in the trends cache
Monitoring

Zabbix server: More than 75% used in the trends cache

In Zabbix, "trends" are a type of data storage representing aggregated historical data. Zabbix monitors and collects a vast amount...

Read moreDetails
Check word count on Google Docs

Check word count on Google Docs

Zabbix server: More than 75% used in the configuration cache

Zabbix server: More than 75% used in the configuration cache

Approve updates in WSUS 2016

Approve updates in WSUS 2016

Configure Group Policy to deploy updates using WSUS 2016

Configure Group Policy to deploy updates using WSUS 2016

Configure computer groups in WSUS 2016

Configure computer groups in WSUS 2016

The initial configuration of WSUS 2016

The initial configuration of WSUS 2016

Get more stuff

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

we respect your privacy and take protecting it seriously

  • Contact
  • Homelab

© 2024 Dimitris Tonias

No Result
View All Result
  • About
  • Contact
  • Free Tools
  • Home
  • Homelab

© 2024 Dimitris Tonias

This website uses cookies. By continuing to use this website you are giving consent to cookies being used.