The easiest way to run a PowerShell script is to run it with the PowerShell command line. For Windows PowerShell, you can open PowerShell by pressing Windows+R and then typing PowerShell.exe. This will open the Windows PowerShell prompt. from here you should type or paste the script path. For example: C:\scripts\script.ps1. Be careful with scripts that you find on the internet or receive from someone you don’t know. PowerShell can manage a lot of the features of your system.

To run PowerShell, you will need to first install the latest version from the PowerShell repository. After it has been installed, you can follow the same steps are described above. The only difference is you will type pwsh.exe rather than powershell.exe.

You can also run PowerShell scripts by using the -File parameter of PowerShell.exe or Pwsh.exe.

PowerShell.exe -File .\myscript.ps1