I am trying to have PowerShell unblock a file in Win2K8 R2.
Does anyone have a pointer as to the syntax?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using PowerShell v3, you can use the
Unblock-Filecmdlet.The “blocking” part is simply an alternate data stream of the file, named “Zone.Identifier”. You can display it in CMD by using input redirection (no other way to get to a stream in CMD, though):
You can find them using
dir /ron Windows Vista and later:Also in CMD you can easily get rid of that by overwriting it (using output redirection, this time):
which isn’t quite the same as removing the ADS completely, but works in that Explorer doesn’t complain anymore.
There doesn’t seem to be native support for handling ADS from within PowerShell (as mentioned on The PowerShell Guy’s blog here. That article also has some information how to get that functionality in PowerShell). You could, however, simply call cmd:
That works from PowerShell as well.
Another option would be Mark Russinovich’s
streamsutility which allows you to inspect a file’s ADS and also to delete them. Sodoes work as well.