This topic contains 3 replies, has 2 voices, and was last updated by
May 7, 2016 at 5:01 pm #38718
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...
May 8, 2016 at 6:33 am #38719ParticipantPoints: 0Rank: Member
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.
It will likely to return "Restricted" (the default setting) or "AllSigned"
For more about execution policies, check out:
And for details on how to change the settings:
help Set-ExecutionPolicy -Full
May 8, 2016 at 11:26 pm #38737
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?
May 10, 2016 at 11:10 pm #38911
I can now run scripts I have built. I will explore generating digital certificates later. Right now I'm practicing...
The topic ‘unblock-file command not working’ is closed to new replies.