![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Set-ExecutionPolicy in RunOnce doesn't work I'm trying to deploy PowerShell using SMS and I need to set the ExecutionPolicy to Unrestricted. Occasionally, the installation requires a restart so I can't just run Set-ExecutionPolicy Unrestricted in the package. I was planning to use RunOnce but it doesn't work. Here are some of the command lines I've tried: %windir%\system32\windowspowershell\v1.0\powershell.exe Set- ExecutionPolicy Unrestricted I've also tried: %windir%\system32\windowspowershell\v1.0\powershell.exe Set- ExecutionPolicy Unrestricted > C:\Logs\ps.txt the file isn't created. I've also tried -noninteractive with the same result. Does anyone know why it doesn't work and how to get it to work? |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Set-ExecutionPolicy in RunOnce doesn't work Hi Try one of the following: 1. PowerShell -Command {Set-ExecutionPolicy Unrestricted} 2. PowerShell -Command "& {Set-ExecutionPolicy Unrestricted}" I suggest you set it with 'remoteSigned', it is more secure. You can also set the value through the registry, search for the value 'ExecutionPolicy' under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell Or even use a GPO Administrative Templates for Windows PowerShell: http://www.microsoft.com/downloads/d...DisplayLang=en --- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: Set-ExecutionPolicy in RunOnce doesn't work Thanks very much for the suggestions - I'm playing with the registry setting at the mo and it's looking good. On 15 May, 12:19, Shay Levi <n...@xxxxxx> wrote:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: Set-ExecutionPolicy in RunOnce doesn't work That's the technique that I use. I use a WSH script with WMI's registry provider; it makes it fairly simple to run through a specific list of machines and directly inspect and/or set the values. There are two special situations you should be aware of with the path shown, moving forward, however. (1) There are distinct keys for the 32 and 64-bit versions of PowerShell if you run 64-bit Windows. The path Shay mentioned is for the OS-native-bit path, so if you want to make sure the 32-bit PowerShell is adjusted on 64-bit Windows, you need to check HKLM\Software\Wow6432Node\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell (2) Moving forward, there will eventually be situations where there are multiple PowerShell version numbers (not just the subpath 1) and multiple product identifiers (not just Microsoft.PowerShell). This isn't likely to be a significant immediate problem, but sometime in the next few years for blanket inspection/modification on a general OS, you'll need to try enumerating subkeys under both 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> Where [Wow6432Node\] is optional. "ssg31415926" <newsjunkmail@xxxxxx> wrote in message news:af780be3-26e4-4922-9320-dffdd2c056ea@xxxxxx
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| setting batchfile to runonce prior to user logon (winxp sp2) | Ben Christian | PowerShell | 7 | 04-17-2008 09:43 AM |
| set-executionpolicy | BinaryCoder | PowerShell | 4 | 11-30-2007 05:59 PM |
| Invoking PS script in RunOnce | greatbarrier86 | PowerShell | 3 | 10-26-2007 10:47 AM |
| IE 7 Runonce Operation Aborted and other errors. | Purtech | Vista General | 0 | 08-19-2007 01:35 PM |
| Set-ExecutionPolicy Unrestricted | Stefan Koell | PowerShell | 28 | 05-07-2007 09:05 AM |