On my workstation I’ve set the powershelle executionpolicy to unrestricted. But there are times I need to run a script directly from a server and I don’t want to change the policy just run this script this one time.
set-executionpolicy can be applied at different levels:
-Scope ExecutionPolicyScope The scope of the execution policy. Valid values: Process Affect only the current PowerShell process. CurrentUser Affect only the current user. LocalMachine Affect all users of the computer.
If you use -scope process it will just change the policy for the existing session.
Its quick and easy, hope this help you in your powershell journey.
Have any other quick powershell tips, leave them in the comments below.