To activate PowerShell's ability to run scripts, use the command Set-ExecutionPolicy RemoteSigned. This command changes the system's security policy to allow local scripts to run while requiring downloaded scripts to be signed by a trusted publisher, effectively "activating" the environment for automation and administration.

PowerShell is a powerful task automation and configuration management framework. By default, Windows restricts the execution of scripts to protect the system from malicious code. Activating the correct execution policy is the first step for anyone looking to run .ps1 files, install certain developer tools, or manage smart home server configurations via the command line.

What You'll Need

  • A computer running Windows 10 or Windows 11.
  • Administrative privileges (you must be logged in as an Administrator).
  • A valid product key if you are attempting to activate a Windows license via PowerShell (though the execution policy is a separate system setting).

Step-by-Step

  1. Open PowerShell as Administrator: Click the Start menu, type "PowerShell," right-click on "Windows PowerShell," and select "Run as administrator." This is critical; the activation commands will fail with an "Access Denied" error if run as a standard user.
  2. Check Current Policy: Before making changes, type Get-ExecutionPolicy and press Enter. This tells you the current state (e.g., "Restricted").
  3. Enter the Activation Command: Type the following command exactly as shown: Set-ExecutionPolicy RemoteSigned and press Enter.
  4. Confirm the Change: The system will prompt you to confirm the change. Type Y (for Yes) or A (for Yes to All) and press Enter.
  5. Verify Activation: Type Get-ExecutionPolicy again. The output should now read "RemoteSigned," confirming that the activation of script execution is complete.
  6. Run Your Script: You can now run scripts by typing the path to the file (e.g., .\myscript.ps1) or by dragging the script file directly into the PowerShell window and pressing Enter.

Common Mistakes

  • Forgetting Administrative Rights: The most common error is opening PowerShell normally instead of using "Run as administrator." Without elevated permissions, the Set-ExecutionPolicy command cannot modify system-wide settings.
  • Typing Errors: PowerShell is sensitive to spelling. Ensure there is a space between Set-ExecutionPolicy and RemoteSigned.
  • Using "Unrestricted" unnecessarily: Some guides suggest using Set-ExecutionPolicy Unrestricted. This is a mistake for most users as it allows any script from any source to run without warning, significantly lowering your system's security.
  • Confusion between Activation and Licensing: Users often search for "activation command" when they mean "Windows license activation." The execution policy activates functionality, not the Windows OS license.

Tips

  • Scope the Policy: If you do not have full administrative rights or only want to activate scripts for your specific user account, use Set-ExecutionPolicy RemoteSigned -Scope CurrentUser.
  • Temporary Activation: If you only need to run one specific script and don't want to change your system settings permanently, you can launch a one-time session using: PowerShell.exe -ExecutionPolicy Bypass -File "C:\path\to\script.ps1".
  • Use Tab Completion: When typing file paths to run scripts, press the Tab key to automatically complete the filename, which prevents typos.

Troubleshooting

If the command does not work or you encounter an error, try these steps in order:

  1. Check for "Access Denied": If you see a red error message mentioning permissions, close PowerShell and ensure you right-clicked and chose "Run as administrator."
  2. Check Registry Overrides: In some corporate environments, Group Policy (GPO) overrides local PowerShell settings. If Get-ExecutionPolicy shows "Undefined" or doesn't change after your command, your organization may have locked this setting.
  3. Restart the Console: Sometimes the environment variables do not refresh immediately. Close all PowerShell windows and reopen a new administrative session.
  4. Check Syntax: Ensure you are not using quotes around RemoteSigned unless you are using a specific script wrapper. The standard command does not require quotes.

Frequently Asked Questions

Is it safe to change the execution policy?

Using "RemoteSigned" is generally considered safe for most users. It allows you to run scripts you wrote yourself while still requiring a digital signature for scripts downloaded from the internet.

Can I undo this activation?

Yes. To return PowerShell to its default secure state, run the command Set-ExecutionPolicy Restricted as an administrator.

What is the difference between RemoteSigned and AllSigned?

RemoteSigned allows local scripts to run without a signature, but requires downloaded scripts to be signed. AllSigned requires every script, including those you create locally, to be signed by a trusted publisher.

Does this command activate my Windows license?

No. This command activates the ability to run scripts. To activate a Windows license, you would typically use the slmgr.vbs command or the Windows Settings app.

Why does my script still not run after activation?

If the policy is set to RemoteSigned but the script was downloaded from a browser, Windows may have "blocked" the file. Right-click the .ps1 file, select Properties, check the "Unblock" box at the bottom, and click OK.