Powershell Execution Policy

Jun 26, 2009 at 6:11 AM

Could you please update the instructions to remind people to set the execution policy to Unrestricted :)  I forgot and took me ages to remember.

Aug 17, 2009 at 10:30 PM

I cannot get any powershell scripts to run on a Windows 2008 Server 64-bit without getting:

System.Management.Automation.ParentContainsErrorRecordException: File C:\Users\jg139\AppData\Local\Temp\54dd9d92-2cb4-4231-a5ef-3a395ccfd00d\tfs-Deploy-Common-Transition.ps1 cannot be loaded. The file C:\Users\jg139\AppData\Local\Temp\54dd9d92-2cb4-4231-a5ef-3a395ccfd00d\tfs-Deploy-Common-Transition.ps1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details..

I followed the instructions for setting the execution policy to Unrestricted which is just a registry entry but to no avail.

Coordinator
Aug 17, 2009 at 11:06 PM

On a 64-bit system PowerShell has both a 64-bit and 32-bit version and each version has its own Execution Policy setting. TFS Deployer is compiled to run as 32-bit because the TFS libraries are 32-bit only, therefore it will use the 32-bit PowerShell and be dependent on that version's Execution Policy setting.

I am working on a patch to TFS Deployer that will make the Execution Policy setting irrelevant to TFS Deployer in the future.

Aug 18, 2009 at 2:50 PM

The 2 registry keys are

HKLM\Software\Microsoft\PowerShell
and
HKLM\Software\Wow6432Node\Microsoft\PowerShell

and for each version number subkey under each of those, you will need to enumerate product keys under ShellIds. Essentially all valid paths are of the form:

HKLM\Software\[Wow6432Node\]Microsoft\PowerShell\<version#>\ShellIds\<productname>