Compare commits
5 Commits
02bc4cbe65
...
e65e6cdd30
Author | SHA1 | Date | |
---|---|---|---|
e65e6cdd30 | |||
4c928ae966 | |||
1eb829dd31 | |||
154acce96c | |||
5744413362 |
@ -1,3 +1,6 @@
|
||||
# chocoWell
|
||||
|
||||
Automate Chocolatey Installation of Packages + Updates
|
||||
Automate Chocolatey Installation of Packages + Updates
|
||||
|
||||
## Installation
|
||||
First install chocolatey
|
||||
|
@ -1,9 +1,58 @@
|
||||
$config = Get-Content 'config.ini' | ConvertFrom-StringData
|
||||
$hostname = $env:COMPUTERNAME
|
||||
Get-Content -Path .\packages_all.txt | ForEach-Object {
|
||||
choco.exe install -y $_
|
||||
$packages = @{}
|
||||
# list packages for all hosts
|
||||
Get-Content -Path "$($config.basePath)/packages_all.txt" | ForEach-Object {
|
||||
$packages[$_] = $_
|
||||
}
|
||||
|
||||
Get-Content -Path .\packages_$hostname.txt | ForEach-Object {
|
||||
choco.exe install -y $_
|
||||
# Check groups of host and list packages
|
||||
$groups = @{}
|
||||
Get-Content -Path "$($config.basePath)/groups_$($hostname).txt" | ForEach-Object {
|
||||
$groups[$_] = $_
|
||||
}
|
||||
choco upgrade all -y
|
||||
foreach ($group in $groups.keys) {
|
||||
Get-Content -Path "$($config.basePath)/packages_$($groups[$group]).txt" | ForEach-Object {
|
||||
$packages[$_] = $_
|
||||
}
|
||||
}
|
||||
|
||||
# Packages only for this host
|
||||
if (Test-Path -Path "$($config.basePath)/packages_$($hostname).txt") {
|
||||
Get-Content -Path "$($config.basePath)/packages_$($hostname).txt" | ForEach-Object {
|
||||
$packages[$_] = $_
|
||||
}
|
||||
}
|
||||
|
||||
# Pakete in der uninstall.txt sollen nicht installiert werden
|
||||
$uninstall = @{}
|
||||
Get-Content -Path "$($config.basePath)/uninstall.txt" | ForEach-Object {
|
||||
if($packages.ContainsKey($_)) {
|
||||
$uninstall[$_] = $_
|
||||
$packages.Remove($_)
|
||||
}
|
||||
}
|
||||
|
||||
# List installed packages
|
||||
$installed = @{}
|
||||
$installedStrings = @(choco list --no-progress)
|
||||
for ($i = 8; $i -lt $($installedStrings.Length -1 ); $i++) {
|
||||
$packagename = $installedStrings[$i].Split(" ")[0]
|
||||
$installed[$packagename] = $packagename
|
||||
}
|
||||
|
||||
# Install packages not in installed package list
|
||||
foreach ($package in $packages.keys) {
|
||||
if ( $installed.ContainsKey($package) -eq 1 ) {
|
||||
continue
|
||||
}
|
||||
choco install -y $package
|
||||
}
|
||||
|
||||
#Pakete in der uninstall deinstallieren
|
||||
foreach ($package in $uninstall.keys) {
|
||||
choco uninstall -y $package
|
||||
}
|
||||
|
||||
# Upgrade all installed packages
|
||||
choco upgrade all -y
|
||||
|
1
config.ini
Normal file
1
config.ini
Normal file
@ -0,0 +1 @@
|
||||
basePath=./files
|
1
files/groups_DESKTOP-HK0UQ3S.txt
Normal file
1
files/groups_DESKTOP-HK0UQ3S.txt
Normal file
@ -0,0 +1 @@
|
||||
pcs
|
@ -1,2 +1,2 @@
|
||||
greenshot
|
||||
lightscreen
|
||||
lightscreen
|
||||
rustdesk
|
@ -1,6 +1,5 @@
|
||||
thunderbird
|
||||
firefox
|
||||
vscode
|
||||
notepadplusplus
|
||||
7zip
|
||||
vlc
|
||||
|
1
files/packages_pcs.txt
Normal file
1
files/packages_pcs.txt
Normal file
@ -0,0 +1 @@
|
||||
vscode
|
1
files/uninstall.txt
Normal file
1
files/uninstall.txt
Normal file
@ -0,0 +1 @@
|
||||
ffmpeg
|
Loading…
Reference in New Issue
Block a user