Unblock a file with PowerShell?

Question!

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

Does anyone have a pointer as to the syntax?



Answers

Do you mean this:

set-executionpolicy remotesigned

This will allow you to execute local scripts without them being signed, and remote ones if they are signed. More info available here.



Remove the alternate file stream using Streams.exe see this post: http://www.paraesthesia.com/archive/2010/05/19/unblocking-multiple-files-at-once.aspx

By : Geert


I wrote a little function that uses the Win32 API to delete the Zone.Identifier NTFS alternate data stream which is what Windows uses to determine whether a file is to be blocked.

.NET doesn't have access to alternate data streams so the function uses a technique called platform invoking to call the native Win32 API. The benefit of this over the some other solutions for PowerShell is that it supports the PowerShell pipeline so you can pipe a list of file paths or System.IO.FileInfo objects to the function. The function also doesn't have any external dependencies and actually deletes the alternate data stream instead of just deleting it's contents.

http://andyarismendi.blogspot.com/2012/02/unblocking-files-with-powershell.html



This video can help you solving your question :)
By: admin