Introduction to the 4 executive rights of PowerShell scripts _powershell

Source: Internet
Author: User

restricted--default settings, do not allow any script to run
allsigned--only script that has been signed with a digital certificate can be run
remotesigned--running local script does not require a digital signature, but running a script downloaded from the network must have a digital signature
unrestricted--allows all script to run

Windows does not allow any scripts to run by default, and you can use the "Set-executionpolicy" cmdlet to change your PowerShell environment. For example, you can use the following command to allow PowerShell to run under unlimited conditions:

Copy Code code as follows:

Set-executionpolicy Unrestricted

However, under Win7, you must start the command command line with administrator privileges, or you will report "Set-executionpolicy: to registry Entries" Hkey_local_machine\software\microsoft\powershell\1\ Access to Shellids\microsoft.powershell "was denied. Error

Using Java to invoke the PowerShell script, you can use the following command:

Copy Code code as follows:

String cmd = "cmd/c powershell-executionpolicy remotesigned-noprofile-noninteractive-file \" "+ Scriptfilename +" "";

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: info-contact@alibabacloud.com 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.