PS has to be restarted to run a script that was unblocked during the same session
If your execution policy is RemoteSigned and you try to execute a downloaded, unsigned script, PowerShell reports an error (as it should.) However, if you then run Unblock-File on that same script and try to run it again, you continue to get the error until you restart PowerShell.
I did some digging, and it turns out that the method PowerShell uses to determine the security zone for a file (IInternetSecurityManager.MapUrlToZone) uses caching, by default. This method has a flag called MUTZDONTUSE_CACHE, which I have confirmed does fix the problem, but will require a code update from the PowerShell team.
Link to original Twitter conversation (including screenshot of file still being "blocked" after Unblock-File): https://twitter.com/sstranger/status/707561420339224576
Link to code I used to verify that setting the MUTZDONTUSE_CACHE flag will fix PowerShell's behavior: https://gist.github.com/dlwyatt/d514afcc1183c20eefc2
We were able to fix this internally, and it should be reaching you in a future Insider build (or via Windows Server 2016 or WMF 5.1, when those get released).
Thanks for making PowerShell even better. :)
Keith Hill commented
@joey Awesome news!
Joel "Jaykul" Bennett commented
Also affects module assemblies, etc.
Dave Wyatt commented
Incidentally, the offending call to MapUrlToZone is in the System.Management.Automation.ClrFacade.MapSecurityZoneWithUrlMon method.