inline Chocolatey installer fails in PowerShell

Originally published on May 1st, 2020 (Last updated on May 1st, 2020)

The choco­latey installer might fail when run in Pow­er­Shell, say­ing some­thing like

[File] cannot be loaded. The script will not execute on the system. See about_Execution_Policies

This is caused by the exe­cu­tion-pol­i­cy of the shell. To allow the installer to work for this ses­sion only, the fol­low­ing com­mand can be used:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

This will allow the installer to exe­cute prop­er­ly. When the shell is closed, every­thing is reset to nor­mal. Sub­se­quent installs of soft­ware from the choco­latey repos­i­to­ries does not need the pol­i­cy set.


No com­ment sec­tion here 😄

You can reach me over at @knuth_dev or send me an Email.