unblock-file command not working

I am taking the Advanced Tools & Scripting with PowerShell 3.0 Jump Start course (Helmick & Snover), and I have downloaded Jason’s scripts. However, the only way I can get these to run is to copy the setup script contents from notepad to the prompt in a PS console. I have unblocked the files, using Jeffry’s command and see a verbose response that all files are unblocked. Every attempt to run these startup scripts still give an error message saying they are not digitally signed. I also examined thread # 18056 which gives some code to determine if a file is actually unblocked: that code indicates my startup scripts are indeed unblocked.
Additional info: Windows 7 box running Powershell Ver 4.0. If I look at the “properties” of these files under Windows, I don’t see a box marked “Blocked.”
Any suggestions? This is kind of a nuisance. Haven’t tried running my own scripts yet…
Peter Marsh

Peter: From what you are describing, it does not sound like a problem with the Unblock-File Cmdlet, but rather that you have not configured the PowerShell ExecutionPolicy.

Try running:

Get-ExecutionPolicy

It will likely to return “Restricted” (the default setting) or “AllSigned”

For more about execution policies, check out:

help about_Execution_Policies

And for details on how to change the settings:

help Set-ExecutionPolicy -Full

I had scope localmachine set for remotesigned, but currentuser set for allsigned. From reading about_execution_policy, it appears the scope setting for currentuser over-rides the remotesigned setting, thus requiring my own scripts to be digitally signed. (Which I don’t yet know how to do.) I changed the scope for Currentuser to remotesigned, and can now run simple scripts from the ISE console window. Should I eventually set the scope for localmachine to allsigned and provide my scripts with a verified digital signature?
Peter

I can now run scripts I have built. I will explore generating digital certificates later. Right now I’m practicing…