-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ps1
146 lines (130 loc) · 4.28 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
<#
AUTHOR: Aidan Brown
Windows Install script w/ bloat removal
#>
# Needs to be run as Admin
#requires -RunAsAdministrator
# Set the Execution policy
Set-ExecutionPolicy Unrestricted
function wslInstall {
# Check if the script is running with administrative privileges
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Please run this script as an administrator."
Exit
}
# Enable Virtual Machine Platform and Hyper-V features required for WSL 2
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
# Download and install the WSL 2 Linux kernel update package
$wslUpdateUrl = "https://aka.ms/wsl2kernel"
$wslUpdatePackagePath = "$env:TEMP\wsl_update.msi"
Invoke-WebRequest -Uri $wslUpdateUrl -OutFile $wslUpdatePackagePath
Start-Process -Wait -FilePath msiexec.exe -ArgumentList "/i $wslUpdatePackagePath /quiet"
Remove-Item -Path $wslUpdatePackagePath
# Set WSL 2 as the default version
wsl --set-default-version 2
Write-Host "WSL 2 feature has been enabled and configured."
}
function appInstall {
# Install Chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install apps (Chocolatey won't install it if it's already on the system)
$apps = @('firefox', 'googlechrome', 'steam-client', 'discord',
'notepadplusplus', 'vscode', 'spotify', 'greenshot', 'powertoys',
'docker-desktop', '7zip', 'runelite', 'adobereader', 'qgis', 'screentogif',
'obsidian', 'nextcloud-client')
choco install $apps -fy
}
function removeBloat {
# Remove bloat
$bloat_apps = @(
"*Microsoft.3DBuilder*"
"*Microsoft.549981C3F5F10*" #Cortana app
"*Microsoft.Asphalt8Airborne*"
"*Microsoft.BingFinance*"
"*Microsoft.BingFoodAndDrink*"
"*Microsoft.BingHealthAndFitness*"
"*Microsoft.BingNews*"
"*Microsoft.BingSports*"
"*Microsoft.BingTranslator*"
"*Microsoft.BingTravel* "
"*Microsoft.BingWeather*"
"*Microsoft.GetHelp*"
"*Microsoft.Messaging*"
"*Microsoft.Microsoft3DViewer*"
"*Microsoft.MicrosoftOfficeHub*"
"*Microsoft.MicrosoftSolitaireCollection*"
"*Microsoft.MicrosoftStickyNotes*"
"*Microsoft.MixedReality.Portal*"
"*Microsoft.NetworkSpeedTest*"
"*Microsoft.News*"
"*Microsoft.Office.OneNote*"
"*Microsoft.Office.Sway*"
"*Microsoft.OneConnect*"
"*Microsoft.Print3D*"
"*Microsoft.SkypeApp*"
"*Microsoft.Todos*"
"*Microsoft.WindowsAlarms*"
"*Microsoft.WindowsFeedbackHub*"
"*Microsoft.WindowsMaps*"
"*Microsoft.WindowsSoundRecorder*"
"*Microsoft.ZuneVideo*"
"*ACGMediaPlayer*"
"*ActiproSoftwareLLC*"
"*AdobeSystemsIncorporated.AdobePhotoshopExpress*"
"*Amazon.com.Amazon*"
"*Asphalt8Airborne*"
"*AutodeskSketchBook*"
"*CaesarsSlotsFreeCasino*"
"*Clipchamp.Clipchamp*"
"*COOKINGFEVER*"
"*CyberLinkMediaSuiteEssentials*"
"*DisneyMagicKingdoms*"
"*Dolby*"
"*DrawboardPDF*"
"*Duolingo-LearnLanguagesforFree*"
"*EclipseManager*"
"*Facebook*"
"*FarmVille2CountryEscape*"
"*fitbit*"
"*Flipboard*"
"*HiddenCity*"
"*HULULLC.HULUPLUS*"
"*iHeartRadio*"
"*king.com.BubbleWitch3Saga*"
"*king.com.CandyCrushSaga*"
"*king.com.CandyCrushSodaSaga*"
"*LinkedInforWindows*"
"*MarchofEmpires*"
"*Netflix*"
"*NYTCrossword*"
"*OneCalendar*"
"*PandoraMediaInc*"
"*PhototasticCollage*"
"*PicsArt-PhotoStudio*"
"*Plex*"
"*PolarrPhotoEditorAcademicEdition*"
"*Royal Revolt*"
"*Shazam*"
"*Sidia.LiveWallpaper*"
"*SlingTV*"
"*Speed Test*"
"*TuneInRadio*"
"*Twitter*"
"*Viber*"
"*WinZipUniversal*"
"*Wunderlist*"
"*XING*"
"*tiktok*"
)
ForEach ($bloat in $bloat_apps){
Write-Output "Attempting to remove $bloat"
Get-AppxPackage -Name $bloat -AllUsers | Remove-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -like $bloat } |
ForEach-Object { Remove-ProvisionedAppxPackage -Online -AllUsers -PackageName $_.PackageName }
}
}
wslInstall
appInstall
removeBloat