forked from matbrgz/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ps1
475 lines (467 loc) · 25.5 KB
/
main.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
$GlobalStopWatch = New-Object System.Diagnostics.Stopwatch
$GlobalStopWatch.Start()
Write-Output "`n [ START ] Configuring System Run"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
Set-ExecutionPolicy RemoteSigned
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] Configuring System Run ... $StopWatchElapsed seconds`n"
Write-Output " ( PRESS KEY '1' FOR EXPRESS INSTALL )
( PRESS KEY '2' FOR CUSTOM INSTALL )"
$InstalationType = Read-Host -Prompt " Option"
$DebugMode = Read-Host -Prompt "`n Enable Debug Mode (y/N)"
if ($DebugMode -eq 'Y' -Or $DebugMode -eq 'y') {
}
$FirstRun = Read-Host -Prompt "`n First time runing script? (Y/n)"
if ([string]::IsNullOrWhiteSpace($FirstRun) -Or $FirstRun -eq 'Y' -Or $FirstRun -eq 'y') {
Write-Output "`n [ START ] Instaling Common Requirements"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
RefreshEnv
cinst -y boxstarter
Import-Module Boxstarter.Chocolatey
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] Instaling Common Requirements ... $StopWatchElapsed seconds`n"
Write-Output "`n [ START ] Windows Update"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
Enable-UAC
Enable-MicrosoftUpdate
Update-Help
Install-WindowsUpdate -acceptEula
Disable-WindowsUpdate
Disable-UAC
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] Windows Update ... $StopWatchElapsed seconds`n"
$Privacy = Read-Host -Prompt "`n Do you care about privacy? (Y/n)"
if ([string]::IsNullOrWhiteSpace($Privacy) -Or $Privacy -eq 'Y' -Or $Privacy -eq 'y') {
Write-Output "`n [ START ] Protecting Privacy"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
#Disables Windows Feedback Experience
Write-Output " [ DOING ] Disabling Windows Feedback Experience program"
$Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
If (Test-Path $Advertising) {
Set-ItemProperty $Advertising Enabled -Value 0
}
#Stops Cortana from being used as part of your Windows Search Function
Write-Output " [ DOING ] Stopping Cortana from being used as part of your Windows Search Function"
$Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
If (Test-Path $Search) {
Set-ItemProperty $Search AllowCortana -Value 0
}
#Disables Web Search in Start Menu
Write-Output " [ DOING ] Disabling Bing Search in Start Menu"
$WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
If (!(Test-Path $WebSearch)) {
New-Item $WebSearch
}
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name DisableWebSearch -Type DWORD -Value 1
Set-ItemProperty $WebSearch DisableWebSearch -Value 1
#Stops the Windows Feedback Experience from sending anonymous data
Write-Output " [ DOING ] Stopping the Windows Feedback Experience program"
$Period = "HKCU:\Software\Microsoft\Siuf\Rules"
If (!(Test-Path $Period)) {
New-Item $Period
}
Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
#Prevents bloatware applications from returning and removes Start Menu suggestions
Write-Output " [ DOING ] Adding Registry key to prevent bloatware apps from returning"
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
$registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
If (!(Test-Path $registryPath)) {
New-Item $registryPath
}
Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
If (!(Test-Path $registryOEM)) {
New-Item $registryOEM
}
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
#Preping mixed Reality Portal for removal
Write-Output " [ DOING ] Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
$Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
If (Test-Path $Holo) {
Set-ItemProperty $Holo FirstRunSucceeded -Value 0
}
#Disables Wi-fi Sense
Write-Output " [ DOING ] Disabling Wi-Fi Sense"
$WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
$WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
$WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
If (!(Test-Path $WifiSense1)) {
New-Item $WifiSense1
}
Set-ItemProperty $WifiSense1 Value -Value 0
If (!(Test-Path $WifiSense2)) {
New-Item $WifiSense2
}
Set-ItemProperty $WifiSense2 Value -Value 0
Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
#Disables live tiles
Write-Output " [ DOING ] Disabling live tiles"
$Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
If (!(Test-Path $Live)) {
New-Item $Live
}
Set-ItemProperty $Live NoTileApplicationNotification -Value 1
#Turns off Data Collection via the AllowTelemtry key by changing it to 0
Write-Output " [ DOING ] Turning off Data Collection"
$DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
$DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
$DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
If (Test-Path $DataCollection1) {
Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
}
If (Test-Path $DataCollection2) {
Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
}
If (Test-Path $DataCollection3) {
Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
}
#Disabling Location Tracking
Write-Output " [ DOING ] Disabling Location Tracking"
$SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
$LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
If (!(Test-Path $SensorState)) {
New-Item $SensorState
}
Set-ItemProperty $SensorState SensorPermissionState -Value 0
If (!(Test-Path $LocationConfig)) {
New-Item $LocationConfig
}
Set-ItemProperty $LocationConfig Status -Value 0
#Disables People icon on Taskbar
Write-Output " [ DOING ] Disabling People icon on Taskbar"
$People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People"
If (!(Test-Path $People)) {
New-Item $People
}
Set-ItemProperty $People PeopleBand -Value 0
#Disables scheduled tasks that are considered unnecessary
Write-Output " [ DOING ] Disabling scheduled tasks"
Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
Get-ScheduledTask Consolidator | Disable-ScheduledTask
Get-ScheduledTask UsbCeip | Disable-ScheduledTask
Get-ScheduledTask DmClient | Disable-ScheduledTask
Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
Write-Output " [ DOING ] Stopping and disabling WAP Push Service"
#Stop and disable WAP Push Service
Stop-Service "dmwappushservice"
Set-Service "dmwappushservice" -StartupType Disabled
Write-Output " [ DOING ] Stopping and disabling Diagnostics Tracking Service"
#Disabling the Diagnostics Tracking Service
Stop-Service "DiagTrack"
Set-Service "DiagTrack" -StartupType Disabled
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] Protecting Privacy ... $StopWatchElapsed seconds`n"
}
$WindowsConfig = Read-Host -Prompt "`n Do wish configure Windows? (Y/n)"
if ([string]::IsNullOrWhiteSpace($WindowsConfig) -Or $WindowsConfig -eq 'Y' -Or $WindowsConfig -eq 'y') {
Write-Output "`n [ DOING ] Setting network category to private"
Set-NetConnectionProfile -NetworkCategory Private
Write-Output "`n [ DOING ] Setting dark theme as default"
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0
Write-Output "`n [ DOING ] Show hidden files, Show file extensions"
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced HideFileExt "0"
#--- File Explorer Settings ---
Write-Output "`n [ DOING ] Adds things back in your left pane like recycle bin"
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Write-Output "`n [ DOING ] Opens PC to This PC, not quick access"
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
Write-Output "`n [ DOING ] Taskbar where window is open for multi-monitor"
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 0
Write-Output "`n [ DOING ] Enable Quick Access: Recent Files"
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 1
Write-Output "`n [ DOING ] Enable Quick Access: Frequent Folders"
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 1
Write-Output "`n [ DOING ] Removing 3D Objects folder"
Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}\'
#pictures
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag' -Name Thispcpolicy "Show"
# videos
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag' -Name Thispcpolicy "Hide"
Stop-Process -processName: Explorer -force # This will restart the Explorer service to make this work.
# music
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag' -Name Thispcpolicy "Hide"
}
Write-Output "`n [ START ] Unistall Windows10 Unnecessary and Blotware Apps"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
$AppXApps = @(
"*Microsoft.BingNews*"
"*Microsoft.GetHelp*"
"*Microsoft.Getstarted*"
"*Microsoft.Messaging*"
"*Microsoft.Microsoft3DViewer*"
"*Microsoft.MicrosoftOfficeHub*"
"*Microsoft.MicrosoftSolitaireCollection*"
"*Microsoft.NetworkSpeedTest*"
"*Microsoft.Office.Sway*"
"*Microsoft.OneConnect*"
"*Microsoft.People*"
"*Microsoft.Print3D*"
"*Microsoft.SkypeApp*"
"*Microsoft.CommsPhone*"
"*Microsoft.WindowsAlarms*"
"*Microsoft.WindowsCamera*"
"*microsoft.windowscommunicationsapps*"
"*Microsoft.WindowsFeedbackHub*"
"*Microsoft.WindowsMaps*"
"*Microsoft.WindowsSoundRecorder*"
"*Microsoft.Xbox.TCUI*"
"*Microsoft.XboxApp*"
"*Microsoft.XboxGameOverlay*"
"*Microsoft.XboxIdentityProvider*"
"*Microsoft.XboxSpeechToTextOverlay*"
"*Microsoft.ZuneMusic*"
"*Microsoft.People*"
"*Microsoft.ZuneVideo*"
#Sponsored Windows 10 AppX Apps
#Add sponsored/featured apps to remove in the "*AppName*" format
"*EclipseManager*"
"*Autodesk*"
"*BubbleWitch*"
"*MarchofEmpires*"
"*McAfee*"
"*Minecraft*"
"*Netflix*"
"*ActiproSoftwareLLC*"
"*AdobeSystemsIncorporated.AdobePhotoshopExpress*"
"*Duolingo-LearnLanguagesforFree*"
"*PandoraMediaInc*"
"*CandyCrush*"
"*Wunderlist*"
"*Flipboard*"
"*Twitter*"
"*Facebook*"
"*Spotify*"
#Optional: Typically not removed but you can if you need to for some reason
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
#"*Microsoft.BingWeather*"
#"*Microsoft.MSPaint*"
#"*Microsoft.MicrosoftStickyNotes*"
#"*Microsoft.Windows.Photos*"
#"*Microsoft.WindowsCalculator*"
#"*Microsoft.WindowsStore*"
)
foreach ($App in $AppXApps) {
Write-Output " [ DOING ] Removing $App from registry"
Get-AppxPackage -Name $App | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -Name $App -AllUsers | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $App | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
}
[regex]$WhitelistedApps = 'Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint*'
Get-AppxPackage -AllUsers | Where-Object { $_.Name -NotMatch $WhitelistedApps } | Remove-AppxPackage
Get-AppxPackage | Where-Object { $_.Name -NotMatch $WhitelistedApps } | Remove-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -NotMatch $WhitelistedApps } | Remove-AppxProvisionedPackage -Online
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] Unistall Windows10 Unnecessary and Blotware Apps ... $StopWatchElapsed seconds`n"
Write-Output "`n [ START ] Remove Unnecessary Windows Registries"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
$Keys = @(
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
#Windows File
"HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
#Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
#Scheduled Tasks to delete
"HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
#Windows Protocol Keys
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
#Windows Share Target
"HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
)
ForEach ($Key in $Keys) {
Write-Output " [ DOING ] Removing $Key from registry"
Remove-Item $Key -Recurse
}
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] Remove Unnecessary Windows Registries ... $StopWatchElapsed seconds`n"
}
else {
$PurgeMode = Read-Host -Prompt "`n Enable Purge Mode (y/N)"
if ($PurgeMode -eq 'Y' -Or $PurgeMode -eq 'y') {
}
}
$AllPrograms = Get-Content 'bootstrap\w10-settings.json' | Out-String | ConvertFrom-Json
if ($InstalationType -eq '1') {
Write-Output "`n [ START ] Software Instalation List"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
$DefaultProgram = Read-Host -Prompt "`n Use default program instalation (y/N)"
ForEach ($row in $AllPrograms.programs) {
if ($DefaultProgram -eq 'Y' -Or $DefaultProgram -eq 'y') {
$row.installation = $row.default
}
}
$AllPrograms | ConvertTo-Json -depth 100 | Out-File -Encoding UTF8 'bootstrap\w10-settings.json'
ForEach ($row in $AllPrograms.programs) {
$ProgramName = $row.name
$ProgramInstallation = $row.installation
Write-Output "$ProgramName : $ProgramInstallation"
}
Start-Sleep -s 3
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] Software Instalation List ... $StopWatchElapsed seconds`n"
}
elseif ($InstalationType -eq '2') {
ForEach ($row in $AllPrograms.programs) {
$ProgramName = $row.name
$ProgramDefault = $row.default
if ($row.default -eq $true) {
$DefaultOption = '(Y/n)'
}
else {
$DefaultOption = '(y/N)'
}
$ProgramOption = Read-Host -Prompt "`n Install $ProgramName ? $DefaultOption"
if ($ProgramOption -eq 'Y' -Or $ProgramOption -eq 'y') {
$ProgramInstallation = $true
}
elseif ([string]::IsNullOrWhiteSpace($ProgramOption)) {
$ProgramInstallation = $ProgramDefault
}
else {
$ProgramInstallation = $false
}
$row.installation = $ProgramInstallation
}
$AllPrograms | ConvertTo-Json -depth 100 | Out-File -Encoding UTF8 'bootstrap\w10-settings.json'
}
else {
}
Write-Output "`n [ DOING ] Enable developer mode on the system"
Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 1
Disable-UAC
$Programs = @(
#Fonts
"hackfont"
"firacode"
"inconsolata"
"dejavufonts"
"robotofonts"
#Default Install
"k-litecodecpackfull"
"googlechrome"
"sysinternals"
# Dev Tools Must Have
"git.install"
"lepton"
"powershell"
"vagrant"
"vscode"
"greenshot"
"GoogleChrome"
# Work use
"wsl"
"wsl-ubuntu-1804"
"docker"
"slack"
"microsoft-windows-terminal"
"azure-cli"
"git"
"poshgit"
"dotnetcore-sdk"
##"kubernetes-helm --version 2.13.1"
# Private use
"steam"
#"leagueoflegends"
"vlc"
)
ForEach ($Program in $Programs) {
Write-Output "`n [ START ] $Program"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
cinst -y $Program
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] $Program ... $StopWatchElapsed seconds`n"
}
RefreshEnv
code --install-extension Shan.code-settings-sync # Vscode needs settings sync from github gist
$AllPrograms = Get-Content 'bootstrap\w10-settings.json' | Out-String | ConvertFrom-Json
ForEach ($row in $AllPrograms.programs) {
$ProgramName = $row.name
$ProgramInstallation = $row.installation
if ($ProgramInstallation -eq $true) {
Write-Output "`n [ START ] $ProgramName"
$StopWatch = [System.Diagnostics.Stopwatch]::StartNew()
$ProgramSlug = $row.program
Invoke-Expression ".\programs\$ProgramSlug.ps1"
$StopWatch.Stop()
$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output " [ DONE ] $ProgramName ... $StopWatchElapsed seconds`n"
}
}
# Install PowerShell modules
$Modules = @(
"poshgit"
"Graphical"
"MSTerminalSettings"
"Terminal-Icons"
"Pansies"
"PowerLine"
"PSProfile"
)
Foreach ($module in Modules){
Install-Module -Name $module -Force -AllowClobber
}
Enable-UAC
RefreshEnv
Start-Process -FilePath 'autoruns' -Wait
$AdobeInstall = Read-Host -Prompt "`n Do you wish to install Adobe Products? (Y/n)"
if ([string]::IsNullOrWhiteSpace($AdobeInstall) -Or $AdobeInstall -eq 'Y' -Or $AdobeInstall -eq 'y') {
Start-Process -FilePath 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' -ArgumentList 'https://old.reddit.com/r/sjain_guides/wiki/downloads'
}
function Set-DefaultBrowser {
param($defaultBrowser)
$regKey = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\{0}\UserChoice"
$regKeyHttp = $regKey -f 'http'
$regKeyHttps = $regKey -f 'https'
switch -Regex ($defaultBrowser.ToLower()) {
# Firefox
'ff|firefox' {
Set-ItemProperty $regKeyHttp -name ProgId FirefoxURL
Set-ItemProperty $regKeyHttps -name ProgId FirefoxURL
break
}
# Google Chrome
'cr|google|chrome' {
Set-ItemProperty $regKeyHttp -name ProgId ChromeHTML
Set-ItemProperty $regKeyHttps -name ProgId ChromeHTML
break
}
}
Set-DefaultBrowser chrome
$GlobalStopWatch.Stop()
$GlobalStopWatchElapsed = $StopWatch.Elapsed.TotalSeconds
Write-Output "`n Total Execution Time ... $GlobalStopWatchElapsed seconds`n"
}
}
else {
Write-Output "`n [ ERROR ] You must execute this script with administrator privileges`n"
}