-
-
Save alber70g/bca2c6aa031df3a3e82d61751ad35dd2 to your computer and use it in GitHub Desktop.
Packages to install via scoop, winget, choco, and other tools...
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
| <# | |
| .SYNOPSIS | |
| Script to Initialize my custom powershell setup. | |
| .DESCRIPTION | |
| Script uses scoop | |
| .NOTES | |
| **NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted. | |
| Author: Mike Pruett | |
| Date: October 18th, 2018 | |
| #> | |
| $VerbosePreference = "Continue" | |
| function Install-ScoopApp { | |
| param ( | |
| [string]$Package | |
| ) | |
| Write-Verbose -Message "Preparing to install $Package" | |
| if (! (scoop info $Package).Installed ) { | |
| Write-Verbose -Message "Installing $Package" | |
| scoop install $Package | |
| } else { | |
| Write-Verbose -Message "Package $Package already installed! Skipping..." | |
| } | |
| } | |
| function Install-WinGetApp { | |
| param ( | |
| [string]$PackageID | |
| ) | |
| Write-Verbose -Message "Preparing to install $PackageID" | |
| # Added accept options based on this issue - https://github.com/microsoft/winget-cli/issues/1559 | |
| $listApp = winget list --exact -q $PackageID --accept-source-agreements --accept-package-agreements | |
| if (!$listApp) { | |
| Write-Verbose -Message "Installing $Package" | |
| winget install --exact --silent $PackageID | |
| } else { | |
| Write-Verbose -Message "Package $PackageID already installed! Skipping..." | |
| } | |
| } | |
| function Enable-Bucket { | |
| param ( | |
| [string]$Bucket | |
| ) | |
| if (! ($(scoop bucket list) -like "$Bucket") ) { | |
| Write-Verbose -Message "Adding Bucket $Bucket to scoop..." | |
| scoop bucket add $Bucket | |
| } else { | |
| Write-Verbose -Message "Bucket $Bucket already added! Skipping..." | |
| } | |
| } | |
| # Configure ExecutionPolicy to Unrestricted for CurrentUser Scope | |
| if ((Get-ExecutionPolicy -Scope CurrentUser) -notcontains "Unrestricted") { | |
| Write-Verbose -Message "Setting Execution Policy for Current User..." | |
| Start-Process -FilePath "PowerShell" -ArgumentList "Set-ExecutionPolicy","-Scope","CurrentUser","-ExecutionPolicy","Unrestricted","-Force" -Verb RunAs -Wait | |
| } | |
| # Install Scoop, if not already installed | |
| $scoopInstalled = Get-Command "scoop" | |
| if (!$scoopInstalled) { | |
| Write-Verbose -Message "Installing Scoop..." | |
| iex ((New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')) | |
| } | |
| # Install Chocolatey, if not already installed | |
| $chocoInstalled = Get-Command "choco" -CommandType Application -ErrorAction Ignore | |
| if (!$chocoInstalled) { | |
| Write-Verbose -Message "Installing Chocolatey..." | |
| @' | |
| [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 | |
| iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
| '@ > $Env:Temp\choco.ps1 | |
| Start-Process -FilePath "PowerShell" -ArgumentList "$Env:Temp\choco.ps1" -Verb RunAs -Wait | |
| Remove-Item -Path $Env:Temp\choco.ps1 -Force | |
| } | |
| # Install WinGet, if not already installed | |
| # From crutkas's gist - https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901 | |
| $hasPackageManager = Get-AppPackage -name "Microsoft.DesktopAppInstaller" | |
| if (!$hasPackageManager) { | |
| Write-Verbose -Message "Installing WinGet..." | |
| @' | |
| # Set URL and Enable TLSv12 | |
| $releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest" | |
| [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
| # Dont Think We Need This!!! | |
| #Install-PackageProvider -Name NuGet | |
| # Install Nuget as Package Source Provider | |
| Register-PackageSource -Name Nuget -Location "http://www.nuget.org/api/v2" -ProviderName Nuget -Trusted | |
| # Install Microsoft.UI.Xaml (This is not currently working!!!) | |
| Install-Package Microsoft.UI.Xaml -RequiredVersion 2.7.1 | |
| # Grab "Latest" release | |
| $releases = Invoke-RestMethod -uri $releases_url | |
| $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith('msixbundle') } | Select -First 1 | |
| # Install Microsoft.DesktopAppInstaller Package | |
| Add-AppxPackage -Path $latestRelease.browser_download_url | |
| '@ > $Env:Temp\winget.ps1 | |
| Start-Process -FilePath "PowerShell" -ArgumentList "$Env:Temp\winget.ps1" -Verb RunAs -Wait | |
| Remove-Item -Path $Env:Temp\winget.ps1 -Force | |
| } | |
| # Remove unused Packages/Applications | |
| $RemoveApps = @("*3DPrint*","Microsoft.MixedReality.Portal") | |
| foreach ($item in $RemoveApps) { | |
| Write-Verbose -Message "Uninstalling: $item" | |
| Start-Process -FilePath "PowerShell" -ArgumentList "Get-AppxPackage","-AllUsers","$item","|","Remove-AppxPackage" -Verb RunAs -Wait -WindowStyle Hidden | |
| } | |
| # Configure git | |
| Install-ScoopApp -Package "git" | |
| git config --global credential.helper manager-core | |
| if (!($Env:GIT_SSH)) { | |
| Write-Verbose -Message "Setting GIT_SSH User Environment Variable" | |
| [System.Environment]::SetEnvironmentVariable('GIT_SSH', (Resolve-Path (scoop which ssh)), 'USER') | |
| } | |
| if ((Get-Service -Name ssh-agent).Status -ne "Running") { | |
| Start-Process -FilePath "PowerShell" -ArgumentList "Set-Service","ssh-agent","-StartupType","Manual" -Verb RunAs -Wait -WindowStyle Hidden | |
| } | |
| # Only install OpenSSH Package, if not on Windows 10 | |
| if ([Environment]::OSVersion.Version.Major -lt 10) { | |
| Install-ScoopApp -Package "openssh" | |
| } | |
| # Configure Aria2 Download Manager | |
| Install-ScoopApp -Package "aria2" | |
| scoop config aria2-enabled true | |
| scoop config aria2-warning-enabled false | |
| @' | |
| $Action = New-ScheduledTaskAction -Execute $Env:UserProfile\scoop\apps\aria2\current\aria2c.exe -Argument "--enable-rpc --rpc-listen-all" -WorkingDirectory $Env:UserProfile\Downloads | |
| $Trigger = New-ScheduledTaskTrigger -AtStartup | |
| Register-ScheduledTask -TaskName "Aria2RPC" -Action $Action -Trigger $Trigger | |
| '@ > $Env:Temp\aria2.ps1 | |
| Start-Process -FilePath "PowerShell" -ArgumentList "$Env:Temp\aria2.ps1" -Verb RunAs -Wait -WindowStyle Hidden | |
| Remove-Item -Path $Env:Temp\aria2.ps1 -Force | |
| ## Add Buckets | |
| Enable-Bucket -Bucket "extras" | |
| Enable-Bucket -Bucket "java" | |
| scoop bucket add foosel https://github.com/foosel/scoop-bucket | |
| # Configure scoop-tray | |
| Install-ScoopApp -Package "scoop-tray" | |
| # Create scoop-tray shortcut in shell:startup | |
| $WSHShell = New-Object -ComObject WScript.Shell | |
| $Shortcut = $WSHShell.CreateShortcut("$Env:AppData\Microsoft\Windows\Start Menu\Programs\Startup\scoop-tray.lnk") | |
| $Shortcut.TargetPath = "$Env:UserProfile\scoop\apps\scoop-tray\current\scoop-tray.bat" | |
| $Shortcut.WindowStyle = 7 | |
| $Shortcut.IconLocation = "%USERPROFILE%\scoop\apps\scoop-tray\current\updates-available.ico" | |
| $Shortcut.Description = "scoop-tray.bat" | |
| $Shortcut.WorkingDirectory = Split-Path "$Env:UserProfile\scoop\apps\scoop-tray\current\scoop-tray.bat" -Resolve | |
| $Shortcut.Save() | |
| # Customize DOS/PowerShell Environment | |
| $DOSTools = @("clink","concfg") | |
| foreach ($item in $DOSTools) { | |
| Install-ScoopApp -Package "$item" | |
| } | |
| Start-Process -FilePath "cmd" -ArgumentList "/c","clink","autorun","install" -Wait -WindowStyle Hidden | |
| Start-Process -FilePath "cmd" -ArgumentList "/c","concfg","import","solarized-dark" -Verb RunAs -Wait | |
| # UNIX Tools | |
| if (Get-Alias -Name curl -ErrorAction SilentlyContinue) { | |
| Remove-Item alias:curl | |
| } | |
| $UnixTools = @("curl","busybox","fzf","neovim","pshazz","cacert","colortool","sudo") | |
| foreach ($item in $UnixTools) { | |
| Install-ScoopApp -Package "$item" | |
| } | |
| if (!($Env:TERM)) { | |
| Write-Verbose -Message "Setting TERM User Environment Variable" | |
| [System.Environment]::SetEnvironmentVariable("TERM", "xterm-256color", "USER") | |
| } | |
| # Development Tools | |
| $DevTools = @("vscode","openjdk","icedtea-web","go","python") | |
| foreach ($item in $DevTools) { | |
| Install-ScoopApp -Package "$item" | |
| } | |
| $DevTools = @("Microsoft.dotnetRuntime.3-x64","Microsoft.dotnetRuntime.5-x64") | |
| foreach ($item in $DevTools) { | |
| Install-WinGetApp -PackageID "$item" | |
| } | |
| # Install Visual Studio Code Integrations | |
| Start-Process -FilePath "cmd" -ArgumentList "/c","reg","import","%UserProfile%\scoop\apps\vscode\current\install-context.reg" -Verb RunAs -Wait -WindowStyle Hidden | |
| Start-Process -FilePath "cmd" -ArgumentList "/c","reg","import","%UserProfile%\scoop\apps\vscode\current\nstall-associations.reg" -Verb RunAs -Wait -WindowStyle Hidden | |
| # Usefull Tools | |
| $UsefullTools = @("gpg","imgburn","paint.net","putty","winscp","spacesniffer","filebot","rufus","etcher") | |
| foreach ($item in $UsefullTools) { | |
| Install-ScoopApp -Package "$item" | |
| } | |
| $UsefullTools = @("Microsoft.WindowsTerminal","Discord.Discord","TeamViewer.TeamViewer","Google.Chrome","Lexikos.AutoHotkey","SumatraPDF.SumatraPDF") | |
| foreach ($item in $UsefullTools) { | |
| Install-WinGetApp -PackageID "$item" | |
| } | |
| # Install syspin | |
| Start-Process -FilePath "PowerShell" -ArgumentList "choco","install","syspin","-y" -Wait -Verb Open | |
| # Pin Run to Taskbar | |
| Start-Process -FilePath "PowerShell" -ArgumentList "syspin","'$Env:AppData\Microsoft\Windows\Start Menu\Programs\Windows System\Run.lnk'","c:5386" -Wait -NoNewWindow | |
| # Pin Google Chrome to Taskbar | |
| Start-Process -FilePath "PowerShell" -ArgumentList "syspin","'$Env:ProgramData\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk'","c:5386" -Wait -NoNewWindow | |
| # Media Utilities | |
| $MediaUtils = @("ffmpeg","mpv","vlc","lame","musicbee","mp3tag","mkvtoolnix","obs-studio","yt-dlp","ocenaudio","mediainfo","mediainfo-gui","cdrtools","cuetools") | |
| foreach ($item in $MediaUtils) { | |
| Install-ScoopApp -Package "$item" | |
| } | |
| $MediaUtils = @("HandBrake.HandBrake","AndreWiethoff.ExactAudioCopy","clsid2.mpc-hc","Plex.Plex","Plex.Plexamp") | |
| foreach ($item in $MediaUtils) { | |
| Install-WinGetApp -PackageID "$item" | |
| } | |
| # System Utilities | |
| $SystemUtils = @("powertoys","open-log-viewer","baretail","bleachbit","hosts-file-editor","minio-client","lessmsi","mqtt-explorer","sysinternals")#,"rktools2k3") | |
| foreach ($item in $SystemUtils) { | |
| Install-ScoopApp -Package "$item" | |
| } | |
| $SystemUtils = @("ScooterSoftware.BeyondCompare4","Eassos.DiskGenius","RevoUninstaller.RevoUninstaller","ElaborateBytes.VirtualCloneDrive","RARLab.WinRAR") | |
| foreach ($item in $SystemUtils) { | |
| Install-WinGetApp -PackageID "$item" | |
| } | |
| # Hardware Monitoring | |
| $HWMon = @("cpu-z","gpu-z","ssd-z","hwmonitor","crystaldiskmark","crystaldiskinfo") | |
| foreach ($item in $HWMon) { | |
| Install-ScoopApp -Package "$item" | |
| } | |
| $HWMon = @("ScooterSoftware.BeyondCompare4","Eassos.DiskGenius","Piriform.Speccy","Piriform.Defraggler") | |
| foreach ($item in $HWMon) { | |
| Install-WinGetApp -PackageID "$item" | |
| } | |
| # Install my PowerShell dot files | |
| Start-Process -FilePath "PowerShell" -ArgumentList "git","clone","https://github.com/mikepruett3/dotposh.git","$Env:UserProfile\dotposh" -Wait -NoNewWindow | |
| @' | |
| New-Item -Path $Env:UserProfile\Documents\WindowsPowerShell -ItemType Directory -ErrorAction Ignore | |
| Remove-Item -Path $Env:UserProfile\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 -Force | |
| New-Item -Path $Env:UserProfile\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 -ItemType SymbolicLink -Target $Env:UserProfile\dotposh\profile.ps1 | |
| '@ > $Env:Temp\dotposh.ps1 | |
| Start-Process -FilePath "PowerShell" -ArgumentList "$Env:Temp\dotposh.ps1" -Verb RunAs -Wait -WindowStyle Hidden | |
| Remove-Item -Path $Env:Temp\dotposh.ps1 -Force | |
| @' | |
| cd $Env:UserProfile\dotposh | |
| git submodule init | |
| git submodule update | |
| '@ > $Env:Temp\submodule.ps1 | |
| Start-Process -FilePath "PowerShell" -ArgumentList "$Env:Temp\submodule.ps1" -Wait -NoNewWindow | |
| Remove-Item -Path $Env:Temp\submodule.ps1 -Force | |
| # Install PowerShell 7 | |
| @' | |
| iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet" | |
| '@ > $Env:Temp\ps7.ps1 | |
| Start-Process -FilePath "PowerShell" -ArgumentList "$Env:Temp\ps7.ps1" -Verb RunAs -Wait -WindowStyle Hidden | |
| Remove-Item -Path $Env:Temp\ps7.ps1 -Force | |
| # Pin PowerShell to Taskbar | |
| Start-Process -FilePath "PowerShell" -ArgumentList "syspin","'$Env:AppData\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows PowerShell.lnk'","c:5386" -Wait -NoNewWindow | |
| # Pin PowerShell 7 to Taskbar | |
| Start-Process -FilePath "PowerShell" -ArgumentList "syspin","'$Env:ProgramData\Microsoft\Windows\Start Menu\Programs\PowerShell\PowerShell 7 (x64).lnk'","c:5386" -Wait -NoNewWindow | |
| # Install Windows SubSystems for Linux | |
| Start-Process -FilePath "PowerShell" -ArgumentList "wsl","--install" -Verb RunAs -Wait -WindowStyle Hidden | |
| Install-WinGetApp -PackageID Canonical.Ubuntu.2004 | |
| Write-Output "Install complete! Please reboot your machine/worksation!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment