PowerShell on Windows 7: Set-ExecutionPolicy for regular users

后端 未结 3 1045
半阙折子戏
半阙折子戏 2020-12-04 14:16

I want to run PowerShell scripts on Windows 7 as a regular user. Whenever I try, I get the following error:

File C:\\Users\\danv\\Documents\\WindowsPowe         


        
相关标签:
3条回答
  • 2020-12-04 14:34
    Set-ExecutionPolicy Unrestricted -Scope CurrentUser
    

    This will set the execution policy for the current user (stored in HKEY_CURRENT_USER) rather than the local machine (HKEY_LOCAL_MACHINE). This is useful if you don't have administrative control over the computer.

    0 讨论(0)
  • 2020-12-04 14:38

    If you (or a helpful admin) runs Set-ExecutionPolicy as administrator, the policy will be set for all users. (I would suggest "remoteSigned" rather than "unrestricted" as a safety measure.)

    NB.: On a 64-bit OS you need to run Set-ExecutionPolicy for 32-bit and 64-bit PowerShell separately.

    0 讨论(0)
  • 2020-12-04 14:49

    This should solve your problem, you should try to run the following below:

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 
    
    0 讨论(0)
提交回复
热议问题