Unblock a file with PowerShell?

Viewed 35891

I am trying to have PowerShell unblock a file in Win2K8 R2.

Does anyone have a pointer as to the syntax?

13 Answers

To unblock a folder and it's subfolder recursive (>= PowerShell v3) you can use the Get-ChildItem (gci) command:

Get-ChildItem "C:\Temp\" -recurse | Unblock-File

where C:\Temp is the starting folder.

You can search for blocked files like this:

get-item * -stream zone*

Then to unblock the files, pipe that to remove-item or "rm" to delete the zone.identifier streams:

get-item * -stream zone* | Remove-Item

In case you want recursive search:

get-childitem -recurse | get-item -stream zone*
Related