Now PowerShell V3 offers us a new cmdlet to tackle these situations with a new cmdlet called as “Unblock-File”
It Helps in unblocking files which are downloaded from internet.
By default, these files are blocked to protect the computer from untrusted files which might contain spyware etc.
Internally, the Unblock-File cmdlet removes the Zone.Identifier property to indicate that it was downloaded from the Internet.
Now let me get details regarding the file with identified stream as “Zone.Identifier”
Get-Item -Stream "Zone.Identifier" 'C:UsersAdministratorDownloadsEnable PS Remoting.ps1' | fl *
Now let me Unblock the file using Unblock-File and rerun Get-Item with stream property.
So above we can see that the stream property returned in an error, we can suppress the error by setting ea=silentlycontinue
Now if i again go and check the properties of the file i do see that its unlocked
I can further automate unblocking of all files present in my c:downloads directory by use powershell pipelining
Get-Item c:usersadministratordownloads* | Unblock-File