Tuesday, December 23, 2008

PoSh v2 CTP3 is out

Download here : http://go.microsoft.com/fwlink/?LinkID=131969

Although it states:

  • Windows PowerShell V2 CTP3 release is compatible with and replaces previous versions of Windows PowerShell. To install the Windows PowerShell V2 CTP3 release you must uninstall any previous version of Windows PowerShell.
  • Windows PowerShell V2 CTP3 uses the execution policy setting from the previous installation, if present. The Windows PowerShell installer does not remove or change the execution policy when you uninstall Windows PowerShell.

On XP, I got bumped from a previous Unrestricted to AllSigned, as I found when starting up the new shell for the first time and getting my start-up script denied.  Going Set-ExecutionPolicy unrestricted then resulted in

Set-ExecutionPolicy : Windows PowerShell updated your
execution policy successfully, but the setting is overridden by a
policy defined at a more specific scope.  Due to the override, your
shell will retain its current effective execution policy of
"AllSigned". For more information, please see "Get-Help
At line:1 char:20
+ Set-ExecutionPolicy <<<<  unrestricted
    + CategoryInfo          : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
    + FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Com

Running the C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe executable directly (not via shortcut) as the local Administrator (right-click, Run as...) lets that user change settings without spitting out a message stating that this is futile; but that is not propagated globally.

Other users (like my usual login) trying to run scripts still got the same

File ...\???.ps1 cannot be loaded. The file ...\???.ps1 
is not digitally signed. The script will not execute on the system. 
Please see "get-help about_signing" for more details..
At line:1 char:2
+ . <<<<  '...\???.ps1'
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

as before, and going Set-ExecutionPolicy unrestricted still results in the same message as above, too!

I've not yet found an official work around to this override through PoSh itself -- but you can directly frob the setting by going to the registry (OK, you can do this in PoSh as well, but it's still "cheating") and setting the value of HKEY_CURRENT_USER\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ExecutionPolicy from AllSigned to Unrestricted.  Although running as Administrator has changed the key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ExecutionPolicy to Unrestricted, any per-user setting that has already been struck from this pattern seems to remain to override this.

LATER : setting the HKCU value to RemoteSigned then leaves me at Unrestricted, until I similarly edit the HKLM key as well. LOL WUT?

Set-ExecutionPolicy still remains ineffective as a normal (local administrator) user.

1 comment :

Finnbarr P. Murphy said...

You are not alone. Same thing happens in Vista SP1.