How do I run powershell scripts without admin rights?

前端 未结 5 705
再見小時候
再見小時候 2021-01-31 22:50

If I try to change the execution policy, I get a message that says I can\'t modify the registry because I\'m not an administrator.

It seems like this should be possible,

5条回答
  •  一向
    一向 (楼主)
    2021-01-31 23:23

    If your domain administrator hasn't forbidden it, you can do this:

    Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
    

    This changes the default execution policy for PowerShell sessions run under the current user, rather than setting it for all users on the machine.

    If you instead want to change the execution policy for just the current PowerShell session, you can use this command:

    Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
    

    However, if your domain administrator is using the "Turn on Script Execution" group policy, you will not be able to change your execution policy at all. The group policy setting makes the Set-ExecutionPolicy cmdlet ineffective.

提交回复
热议问题