In Part 1 of this 2-part series, I showed you how to re-install in order to eliminate the errors. But at the end of that post, you surely noticed that while I fixed one problem, I seemigly created another. Now it appears that I have red error text because it can’t load my profile script, and tons of scripts prompting me to execute. It looked like this:
This is strange… because I’m fairly certain my ExecutionPolicy is set to something lower, like RemoteSigned… Hmm. Let’s take a look at what my *combined* policy is set at, by issuing the Get-ExecutionPolicy -List command like this:
That’s strange too. But I see now that there’s a limiting policy on the *process*, so at least I know why this is happening (by the way, ignore that Unrestricted on LocalMachine 😉 ). Clearly, I’m shooting myself in the foot with the cumulative permissions. So, let’s try and figure out how that restriction is getting set on my system by chasing down the PowerShell link. Right-click on the Windows Azure PowerShell icon and choose Open File Location:
Then, right-click on the Windows Azure PowerShell link and choose Properties. And guess what we find:
Yes, it appears that the shortcut/tile/link has hard-coded the ExecutionPolicy of AllSigned, which means it will permit only execution of — and request your validation of — certificate-signed scripts.
Aside: This is where I tell you that normally, using AllSigned is probably a good thing; and although I’m not making an official recommendation of lowering that setting in production, I will tell you honestly that I typically use RemoteSigned on my laptop and feel it to be sufficient for my needs.
So with that clarification out of the way, let’s change this setting and make our life a lot easier. To do so, change:
C:WINDOWSSysWOW64WindowsPowerShellv1.0powershell.exe -NoExit -ExecutionPolicy AllSigned -File "C:Program Files (x86)Microsoft SDKsWindows AzurePowerShellAzureShortcutStartup.ps1"
…to (you will be prompted for Administrator-level permission):
C:WINDOWSSysWOW64WindowsPowerShellv1.0powershell.exe -NoExit -ExecutionPolicy RemoteSigned -File "C:Program Files (x86)Microsoft SDKsWindows AzurePowerShellAzureShortcutStartup.ps1"
…and now things should be back to normal.
Look! Even my startup script runs now. Ah… Feel that? It’s Azure Zen goodness…