-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHydrate.ps1
208 lines (179 loc) · 6.59 KB
/
Hydrate.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#Requires -RunAsAdministrator
#Requires -Modules @{ ModuleName="Appx"; ModuleVersion="2.0.1.0" }
<#
.SYNOPSIS
A quick method to install all the packages to install and use on a newly provisioned Windows Dev machine
.DESCRIPTION
This Hydrator is a simple PowerShell script that, when run on your disposable target machine, soak the
system with a preset list of apps and utilities. There's a good chance that this script won't meet your
list of preferred tools. You are free to modify it with the list of applications and utilities.
.PARAMETER InstallAll
Instruct the script to install all packages
.PARAMETER SkipMandatory
Instruct the script to skip the Mandatory packages
.PARAMETER InstallAzTools
Instruct the script to install the Azure Tools
.PARAMETER InstallGitTools
Instruct the script to install the Git Tools
.PARAMETER InstallDevTools
Instruct the script to install the Dev Toys
.PARAMETER Fonts
Instruct the script to install the Nerd Fonts
.NOTES
This script is not supported in Linux
.LINK
https://github.com/volatile-torpedo/SpringBox
.EXAMPLE
Hydrate.ps1 -InstallAll
Installs all packages: Mandatory, Azure Tools, Git Tools and Dev Tools
Hydrate.ps1 -SkipMandatory -InstallAzTools -InstallGitTools -InstallDevTools
Installs Azure Tools, Git Tools and Dev Tools, but skips the Mandatory packages
Hydrate.ps1 -Fonts
Installs only the Nerd Fonts
#>
param (
[switch]$InstallAll,
[switch]$SkipMandatory,
[switch]$InstallAzTools,
[switch]$InstallGitTools,
[switch]$InstallDevTools,
[switch]$Fonts
)
# Functions
function Get-YesNo {
param (
[string]$Message
)
Write-Host "$Message [y/n]" -ForegroundColor Yellow -NoNewline
$UResponse = Read-Host -Prompt " "
switch ($UResponse) {
"y" { return $true }
"n" { return $false }
default {
Write-Host "Only 'Y' or 'N' allowed!" -ForegroundColor Red
Get-YesNo -Message $Message
}
}
}
# Variables
$Mandatory = @(
"Microsoft.WindowsTerminal",
"JanDeDobbeleer.OhMyPosh",
"Graph X-Ray", # MS Store ID: 9N03GNKDJTT6
"Greenshot.Greenshot",
"Microsoft.PerfView",
"Microsoft.PowerShell"
)
$AzureTools = @(
"Microsoft.AzureCLI",
"Microsoft.AzureStorageExplorer",
"Microsoft.AzureDataStudio",
"Microsoft.Azure.FunctionsCoreTools",
"Microsoft.AzureKustoExplorer",
"Microsoft.AzureKustoIngestion",
"Microsoft.AzureKustoTool",
"Azure News Reader",
"Hashicorp.Terraform"
)
$GitTools = @(
# "Microsoft.VisualStudioCode",
"Git.Git",
"GitHub.GitHubDesktop",
"GitHub.cli",
"TobySuggate.GitFiend",
"Microsoft.PowerToys",
"StephanDilly.gitui"
)
$DevStack = @(
"Microsoft.VisualStudioCode",
"DevToys",
"Docker.DockerDesktop",
"easyWSL"
"OpenJS.NodeJS.LTS"
# "Python.Python.3.11" # Already installed along with Chocolatey with OpenJS.NodeJS.LTS
)
# Prompt for Options, but Skip all prompts if $InstallAll is set
if ($InstallAll.IsPresent) {
$SkipMandatory = $false
$InstallAzTools = $true
$InstallGitTools = $true
$InstallDevTools = $true
}
else {
$SkipMandatory = Get-YesNo -Message "Do you want to skip the Mandatory packages?"
$InstallAzTools = Get-YesNo -Message "Do you want to install the Azure Tools?"
$InstallGitTools = Get-YesNo -Message "Do you want to install the Git Tools?"
$InstallDevTools = Get-YesNo -Message "Do you want to install the Dev Tools?"
}
# Set Execution Policy for subsequent scripts
Set-ExecutionPolicy RemoteSigned -scope CurrentUser -Force
# Install or Update PowerShellGet, Az and winget
Install-PackageProvider -Name NuGet -Force
if (-not(Get-InstalledModule PowerShellGet -ErrorAction SilentlyContinue)) {
Install-Module -Name PowerShellGet -Scope AllUsers -Force -SkipPublisherCheck -Confirm:$false
}
else {
Update-Module PowerShellGet -Force
}
if (-not(Get-InstalledModule Az -ErrorAction SilentlyContinue)) {
Install-Module -Name Az -Scope AllUsers -Force -SkipPublisherCheck -Confirm:$false
}
else {
Update-Module Az -Force
}
winget upgrade --accept-source-agreements --accept-source-agreements
# Install Mandatory packages
if (-not $SkipMandatory) {
Write-Host "🚧 SkipMandatory is not set. Installing Mandatory packages..." -ForegroundColor Green
Foreach ($package in $Mandatory) {
winget install -e --id $package --accept-source-agreements --accept-package-agreements
}
# Install SysInternals Suite
Invoke-WebRequest 'https://download.sysinternals.com/files/SysinternalsSuite.zip' -OutFile .\SysInternalsSuite.zip
Expand-Archive .\SysInternalsSuite.zip .\SysInternals
Remove-Item .\SysInternalsSuite.zip
# Install Nerd Fonts
& $PsScriptRoot/bin/nerdfonts/install.ps1
# PreConfigure Windows Terminal
Copy-Item -Path "$($PsScriptRoot)/bin/terminal_profile/settings.json" -Destination "$($env:LOCALAPPDATA)/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json" -Force
# Copy Terminal PS $PROFILE
Copy-Item -Path "$($PsScriptRoot)/bin/ps_profile/Microsoft.PowerShell_profile.ps1" -Destination "$([Environment]::GetFolderPath("mydocuments"))/PowerShell/Microsoft.PowerShell_profile.ps1" -Force
}
else {
Write-Host "SkipMandatory is set. Ignoring Mandatory packages..." -ForegroundColor DarkYellow
}
# Install Azure Stack
if ($InstallAzTools) {
Write-Host "🚧 AzureStack is set. Installing Azure Stack packages..." -ForegroundColor Green
Foreach ($package in $AzureTools) {
winget install -e --id $package --accept-source-agreements --accept-package-agreements
}
}
else {
Write-Host "AzureStack is not set. Ignoring Azure Stack packages..." -ForegroundColor DarkYellow
}
# Install Git Tools
if ($InstallGitTools) {
Write-Host "🚧 GitTools is set. Installing Git Tools packages..." -ForegroundColor Green
Foreach ($package in $GitTools) {
winget install -e --id $package --accept-source-agreements --accept-package-agreements
}
}
else {
Write-Host "GitTools is not set. Ignoring Git Tools packages..." -ForegroundColor DarkYellow
}
# Install Dev Stack
if ($InstallDevTools) {
Write-Host "🚧 DevStack is set. Installing Dev Stack packages..." -ForegroundColor Green
Foreach ($package in $DevStack) {
winget install -e --id $package --accept-source-agreements --accept-package-agreements
}
# Copy VSCode terminal PS $PROFILE
Copy-Item -Path "$($PsScriptRoot)/bin/ps_profile/Microsoft.VSCode_profile.ps1" -Destination "$([Environment]::GetFolderPath("mydocuments"))/PowerShell/Microsoft.VSCode_profile.ps1" -Force
}
else {
Write-Host "DevStack is not set. Ignoring Dev Stack packages..." -ForegroundColor DarkYellow
}
# TODO:
# [x] Add PowerShell $PROFILE files to Documents/PowerShell
# [x] Adjust Terminal settings.json source folder