PowerShell: Install Software via Online Repository (Chocolatey)

PowerShell: Install Software via Online Repository (Chocolatey)

https://ift.tt/3utMd7u

Chocolatey is an Online Respository for popular software products. Online repositories provide a convenient way to install software, such as Adobe Reader, WinZip … It is also possible to install multiple software at once. In this blog post I will carry out installing chocolatey and perfrom some action with it. Let’s dive in.

Install Chocolatey

First of all we need to install the package manager. In order to do this we are supposed to set the PowerShell execution policy to bypass. Don’t worry, the setting will be changed for this session only.

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Next, install chocolatey via the WebClient.

Invoke-Expression `
((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Fine. We are now ready to perform some action.

Find Software

Build on the examples below to find the software you are looking for. Use the find parameter.

choco find googlechrome

choco find adobereader

Use the info parameter to find more about your software product.

choco info googlechrome

Install Software

Once you have found your product, install it. You are able to install multiple software products at once. The -y parameter installs the products in silent mode.

choco install googlechrome adobereader -y

Upgrade Software

To install updates, specify the package name and use the upgrade parameter.

Don’t worry about the red ones here. It’s all good 😉

choco upgrade googlechrome adobereader -y

List installed Software

For getting an overview, use choco list -lo.

choco list -lo

Install Software on multiple Computers

This part is just to give you thoughts for ideas. This will not actually work. Why? Chocolatey limits downloads per IP address to one IP in a given time to avoid denial of service attacks. To get around this, create your own repository without restrictions. Nevertheless, I will show you where the journey would go.

Installing a software product on all Windows 10 computers in a specific OU.

$Computers = Get-ADComputer -Filter * `
-SearchBase "OU=Windows 10,DC=domain,DC=com" | 
Select-Object -ExpandProperty Name

Invoke-Command -ComputerName $Computers -ScriptBlock {

    choco install googlechrome -y 

}

Cool stuff.

Thank you for reading this article.

See also

powershell,virtualization,01. +++++,windows

via SID-500.COM https://sid-500.com

April 7, 2021 at 03:17PM
Patrick Gruenauer