Install Chocolatey via PowerShell & software in post-setup


New Member
I use Chocolatey ( as my source of software installation and would like to know if it is possible to run a Powershell script to install chocolatey (and maybe the software I need) during the post setup. Normally you run the following command in Powershell to install Chocolatey

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))

After that you can install software via the powershell with
choco install adobereader
for example.

You can even automatically confirm every installation aka silent install with
choco feature enable -n allowGlobalConfirmation
to skip the "Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint):" during the installation.

So, my thoughts are to include three scripts:

1) Install Chocolatey
2) Allow auto-confirm every installation
3) Including the installation command for all the software I need

The problems I have so far are:
1) I have no clue how to write a powershell script (Can I simply put the code above in a file and save it as powershell script?)
2) Chocolatey needs to run in administrative shell to work. Is this somehow possible during post-setup?

Maybe you can point me in the right direction to make this work.


Staff member
Write a short batch script, ChocolateyInstall.bat. You need to add Chocolatey's path before calling it.
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))"
set PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

choco install adobereader -y

My preference would be not disabling confirmations, unless that's your command-line preference.

Windows 10 x64-2022-07-27-13-01-52.png