Windows 10 – Chocolatey-paketinhallinta ja ohjelmistoasennusten automatisointiskripti


Chocolatey on komentorivipohjainen paketinhallinta Windows-käyttöjärjestelmille. Sen tuki ei ole yhtä laajaa kuin esimerkiksi Debian-Linuxin apt-get -paketinhallinnalla, mutta Chocolateystä löytyy silti yli 7700 asennettavaa pakettia.

Kunnes olen saanut Microsoft 365 -tenanttini Intune-mobiililaitehallinnan käytännöt valmiiksi, tulen käyttämään Chocolatey-paketinhallintaa ohjelmistoasennusten nopeuttamiseksi testikoneeni uudelleenasennusten yhteydessä.


Asennus PowerShellissä korotetuin oikeuksin:

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


Getting latest version of the Chocolatey package for download.
Getting Chocolatey from
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\Users\Markus\AppData\Local\Temp\chocolatey\chocInstall\ to C:\Users\Markus\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
(i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
upgrading from a version of Chocolatey less than 0.9.9.
'Batch file could not be found' is also safe to ignore.
'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\Markus\OneDrive - Markus
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder

Tiettyä asennuspakettia voidaan etsiä paketinhallinnasta seuraavalla komennolla. Itse käytän esimerkkinä VLC-mediatoistinta:

choco search <paketin nimi>
choco search vlc

Tulos, jossa etsimäni versio lihavoituna:

Chocolatey v0.10.15
vlc 3.0.10 [Approved]
vlc-skins 2017.01.13 [Approved]
vlc-nightly [Approved]
vlc.portable 2.2.1 [Approved] Downloads cached for licensed users
vlc-skin-editor 0.8.5 [Approved]
fbvlc 0.1.5 [Approved] - Possibly broken
fleex 2.3.1
pympress 1.4.1 [Approved] Downloads cached for licensed users
MediathekView 13.5.1 [Approved]
vp8-vfw [Approved]
dspeech 1.73.1 [Approved] Downloads cached for licensed users
mpvnet.install [Approved] Downloads cached for licensed users
12 packages found.

Tarkemmat tiedot paketista yksittäisestä paketista saa komennolla:

choco search <paketin nimi> -e -v
choco search vlc -e -v


Chocolatey v0.10.15
vlc 3.0.10 [Approved]
Title: VLC media player | Published: 28.4.2020
Package approved as a trusted package on huhti 29 2020 01.51.36.
Package testing status: Passing on huhti 29 2020 00.48.57.
Number of Downloads: 6159062 | Downloads for this version: 231098
Package url
Chocolatey Package Source:
Package Checksum: 'JmQU9LtmSyuhCohXCv4yKPm+Vkx091GlTirSCe39nlWSyHLSQdeRMki1DrZ29flYBmQ/QFPkQxmKpyHttTCbLA==' (SHA512)
Tags: vlc foss cross-platform multimedia audio video mp3 dvd avi media player admin
Software Site:
Software License:
Software Source:
Summary: VLC Media Player
Description: VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVD, Audio CD, VCD, and various streaming protocols.


## Features

- Plays Files, Discs, Webcams, Devices and Streams.
- Fast - Hardware Decoding.
- Plays most codecs with no codec packs needed - MPEG-2, MPEG-4, H.264, MKV, WebM, WMV, MP3...
- Complete feature-set over the video, subtitle synchronisation, video and audio filters.
- Runs on all platforms - Windows, Linux, Mac OS X, Unix, iOS, Android ...
- Completely Free - no spyware, no ads and no user tracking.

## Package parameters

- `/Language:en` - Two letter language code: nl, en, fr ...

Example: `choco install --params "/Language:fr"` *Will set the language of VLC to french*

## Notes

- Related packages: [vlc-skins]( [vlc-nightly](

1 packages found.

Yksittäisen paketin asennus komennolla:

choco install <paketin nimi>
choco install vlc


Chocolatey v0.10.15
Installing the following packages:
By installing you accept licenses for the packages.
Progress: Downloading chocolatey-core.extension 100%
Progress: Downloading vlc 3.0.10... 100%

chocolatey-core.extension v1.3.5.1 [Approved]
chocolatey-core.extension package files install completed. Performing other installation steps.
Installed/updated chocolatey-core extensions.
The install of chocolatey-core.extension was successful.
Software installed to 'C:\ProgramData\chocolatey\extensions\chocolatey-core'

vlc v3.0.10 [Approved]
vlc package files install completed. Performing other installation steps.
The package vlc wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): y

Installing x64 bit version
Installing vlc...
vlc has been installed.
vlc installed to 'C:\Program Files\VideoLAN\VLC'
vlc registered as vlc
vlc may be able to be automatically uninstalled.
The install of vlc was successful.
Software installed to 'C:\Program Files\VideoLAN\VLC'

Chocolatey installed 2/2 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Kätevää, mutten jaksa syöttää komentoa jokaisella ohjelmalle yksitellen.


Tein PowerShell-skriptin, joka asentaa Chocolateyn ja kaikki kaipaamani ohjelmat yhdellä kertaa. Tallensin skriptin nimellä ChocoInstall.ps1.

# 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(''))

# Install default applications
function InstallDefaultApps {
	choco install foxitreader -y
	choco install googlechrome -y
	choco install jre8 -y
	choco install firefox -y
	choco install 7zip.install -y
	choco install notepadplusplus.install -y
	choco install vlc -y
	choco install microsoft-teams.install -y
	choco install gimp -y
	choco install keepass.install -y
	choco install steam -y
	choco install foobar2000 -y
	choco install discord -y
	choco install malwarebytes -y
	choco install microsoft-edge -y
	choco install teamviewer -y

# Install useful applications
function InstallUsefulApps {
	choco install putty.install -y
	choco install sysinternals -y
	choco install winscp.install -y
	choco install virtualbox -y
	choco install wireshark -y
	choco install fiddler -y
	choco install youtube-dl -y
	choco install windirstat -y
	choco install audacity -y
	choco install ffmpeg -y
	choco install windows-adk -y
	choco install gpg4win -y
	choco install obs-studio -y
	choco install yumi -y
        choco install arduino -y

# Execute functions

Suoritetaan skripti PowerShellissä kutsumalla sitä siinä sijainnissa, jossa skripti sijaitsee:


Tuo asentaa kaikki ohjelmat yhdellä kertaa.


Leave a Comment

Your email address will not be published.

Scroll to Top