GameIndustry.eu /  Blog /
EnglishHow to run Powershell scripts in Windows


How to run Powershell scripts in Windows

Eingetragen: 05.09.2023

Powershell
PowerShell in Windows 11 is a powerful command-line interface and scripting language designed to facilitate system administration and automation of tasks on Windows operating systems.

With PowerShell, users can perform administrative tasks, system configuration, and management tasks in Windows 11 by using commands and scripts. This includes creating, modifying and deleting files, managing user accounts, monitoring system resources and automating maintenance and administration tasks.



There can always be scenarios in which Powershell is used to run unsigned (e.g. self-written) scripts. By default, running scripts on your own system is not allowed, as it poses potential security risks.

The behavior can be enforced with just a few lines of input and can also be reversed again.

  1. Open the powershell icon via the Windows start menu with admin rights (right click "open as administrator")
  2. First check the currently assigned rights by entering the following command

 Get-ExecutionPolicy

There can be 5 return values as an answer
  1. AllSigned: All scripts, both local and downloaded, must be digitally signed to run.
  2. Bypass: Scripts are executed without restrictions. This is the least restrictive execution policy.
  3. RemoteSigned: Local scripts can run without a digital signature, but downloaded scripts must be signed.
  4. Restricted: Script execution is NOT allowed. This is the most restrictive execution policy and the default policy.
  5. Unrestricted: All scripts can be run without restrictions.

While "Bypass" is often only used temporarily, "Unrestricted" represents a more permanent solution to run.

To e.g. To be able to run scripts without digital signatures, enter the following line in Powershell

 Set-ExecutionPolicy RemoteSigned

If you no longer need scripts, you should reset the execution policies so that no more scripts can be executed.

To do this, enter the command

 Set-ExecutionPolicy Restricted


This stops scripts from running again.

 

 

  Rules for posting comments can be found in the F.A.Q.