Created
December 14, 2023 14:50
-
-
Save xjunko/33c9b3d3590522bac1aada0f845c6ab8 to your computer and use it in GitHub Desktop.
Ripped off from some dude in SO, for my own use cuz I'm forced to use wangblowz.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## To fix "cannot be loaded because running scripts is disabled on this system" (run: 'get-executionpolicy' returns: Restricted) --> | |
set-executionpolicy remotesigned | |
# Run following to bypass "not digitally signed" issue (fixes per session only) | |
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass | |
$dryRun = $false; | |
$packages = 'packages.txt' | |
write-host "`n---+++ START powershell script to install packages, using chocolately (`chocolatey.org`) +++---`n" | |
if($dryRun) { | |
write-host "... DRY RUN ONLY ..." | |
} | |
$chocoIsInstalled = Test-Path -Path "$env:ProgramData\Chocolatey" # Get-Command choco.exe -ErrorAction SilentlyContinue | |
if ($chocoIsInstalled) { | |
write-host "`n--> Chocolately is already installed ---`n" | |
} | |
else { | |
write-host "`n--> Chocolately was not installed, let's install it! ---`n" | |
if(!$dryRun) { | |
write-host "Just kiddin', not gonna install choco" | |
} | |
else { | |
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
} | |
} | |
$array = (gc $packages) -notmatch '^\s*$' -notmatch '^#' | ? {$_.trim() -ne "" } | |
foreach($item in $array) | |
{ | |
write-host "`n* --> Next package install: '${item}'`n" | |
if($dryRun) { | |
write-host "Just kiddin', not gonna do it" | |
} | |
else { | |
choco install $item -fy | |
} | |
} | |
write-host "`n---+++ FINISH install script +++---`n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment