Pssecurityexception PowerShell permission settings

Source: Internet
Author: User

The default permission level for Windows PowerShell is Restricted, which does not allow the execution of PS scripts (that is,. ps1 files). If you run under the Restricted permission level, you get an error message:

. \xxxx.ps1:file
XXXX.PS1 cannot be loaded because running scripts are disabled on the this system. For more information, see about_execution_policies at
At Line:1 char:1
+. \xxxx.ps1 params[] ...
+ ~~~~~~~~~~~~~~~~~~~~
+ Categoryinfo:securityerror: (:) [], Pssecurityexception
+ fullyqualifiederrorid:unauthorizedaccess

To resolve such problems, it is common practice to start the PS command line with administrator privileges and modify the execution permissions to remotesigned or unrestricted:

Set-executionpolicy remotesigned

Here, it is generally possible to solve the problem in most cases.

However, sometimes it is found that some PS script will still throw the above error. If your system is a 64-bit Windows, then it is possible that you execute scripts that are called Powershell.exe not the one you have changed permissions for. Run PowerShell from the following two locations and view the permission settings:

    • C:\Windows\System32\WindowsPowerShell\v1.0
    • C:\Windows\SystemWoW64\WindowsPowerShell\v1.0

If there is a restricted change it to remotesigned or unrestricted.

Reference: Https:// Forum=winserverpowershell

Pssecurityexception PowerShell permission settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.