DEV Community

Discussion on: Hello World in PowerShell

maxalmonte14 profile image

Sadly the script file won't run by default on Windows due to a security policy. To change the policy and subsequently run the script you need to do the following:

1 - Open Run Command/Console ( Win + R )
2 - Type: gpedit.msc (Group Policy Editor)
3 - Browse to Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Windows Powershell.
4 - Enable "Turn on Script Execution"
5 - Set the policy as needed. I set mine to "Allow all scripts".