Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just upgraded to Windows 7 and I want to get my Powershell profile up and running.

I load PS and set the execution policy to unrestricted with my 'run as admin' powers, then put my profile in the appropriate place. I reload PS and it errors.

get-execution policy returns restricted.

However, the registry check returns unrestricted.

After a reboot, the situation remains the same.

Checking further, I observe that under Admin mode, I have Unrestricted powers, but as a regular user, I have Restricted powers.

After doing some Powershell work in XP today, I noticed that in XP, Powershell is always in admin mode. Evidently it got turned into usermode on Win7. Aargh!

How do I get my profile script to execute in regular user mode?

share|improve this question

I don't have any trouble with this. Here's what I tested on a pretty clean Windows 7 machine:

  • Log in as an administrator
  • Run PowerShell elevated ("as Administrator")
  • Set-ExecutionPolicy RemoteSigned
  • Log in as Guest
  • Run PowerShell
  • Get-ExecutionPolicy

Returns RemoteSigned

share|improve this answer

I would right click powershell, go to compatibility options, select "Run this program as an administrator"

If using a script, you could use start++'s sudo implementation. There is a way to do it without the tool, but it's simpler just to use the tool, and it adds some other useful tools anyway.

share|improve this answer
Yeah, but I don't want to run it as an administrator. Running as root by default is not how I like to roll. – Paul Nathan Jan 22 '10 at 18:44

Do you run it from the command line or from the start menu. For me, I only get the "unrestricted" policy if I run powershell from the start menu link.

Starting it from the command line or from another program I could only get the "restricted" policy. Couldn't find any workaround for this issue except for running powershell from the start menu link...

share|improve this answer

With Windows 7 (Ultimate in case its relevant, can't see how) I have to be in administrator mode to set the policy but once set it applies to my normal user profile (get-executionpolicy returns "Unrestricted"). When you say you move your profile to the "usual place", what exactly do you mean?

share|improve this answer

This works for me temporarily until I reboot the machine, at which time I have to rerun the script. I know scope CurrentUser and LocalMachine write registry entries and so you would think the setting would be persistent/permanent but , after reboot on my domain, it seems that it reverts to the default of AllSigned.

# SetExecutionPolicyToRemoteSigned.ps1
# Not persistent.  Need to run this after every server reboot.
Write-Output "Setting local Powershell policy to RemoteSigned"
Write-Output ""

Set-ExecutionPolicy -scope CurrentUser Undefined -Force
#Set-ExecutionPolicy -scope Process Undefined -Force
Set-ExecutionPolicy -scope LocalMachine Undefined -Force

Set-ExecutionPolicy -scope CurrentUser RemoteSigned -Force
#Set-ExecutionPolicy -scope Process RemoteSigned -Force
Set-ExecutionPolicy -scope LocalMachine RemoteSigned -Force

Write-Output "Finished."

Get-ExecutionPolicy -list
Start-Sleep -s 10
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .