-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostinstall.ps1
More file actions
211 lines (183 loc) · 10.9 KB
/
postinstall.ps1
File metadata and controls
211 lines (183 loc) · 10.9 KB
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
$productname = (Get-ComputerInfo).WindowsProductName
# User Choices
$choices = Read-Host "Would you like to run this script with (d)efault or (c)ustomized settings? (d/c)"
if ($choices -eq 'd') {
$office = '1'
$act = 'y'
$store = 'y'
$xbox = 'y'
$cookies = 'y'
if ($productname -match "^Windows 10" -and $productname -notmatch "LTSC|LTSB") {
$esu = 'y'
}
}
else {
Write-Host "Press 0 for No Office Suite"
Write-Host "Press 1 for OnlyOffice"
Write-Host "Press 2 for Microsoft Office"
$office = Read-Host "Would you like to install an Office Suite? (0/1/2)"
if ($office -eq '2') {
$oact = Read-Host "Would you like to activate Microsoft Office? (y/n)"
}
$act = Read-Host "Would you like to activate Windows? (y/n)"
$store = Read-Host "Would you like to keep or install the Microsoft Store? (y/n)"
$xbox = Read-Host "Would you like to keep or install Xbox components? (y/n)"
$cookies = Read-Host "Would you like cookies and site data to be cleared by default on exit in the LibreWolf Browser? (y/n)"
if ($productname -match "^Windows 10" -and $productname -notmatch "LTSC|LTSB") {
Write-Host "Windows 10 non-LTSC Detected." -F Blue
$esu = Read-Host "Would you like to activate Extended Security Updates (Recommended)? (y/n)"
}
}
# Windows Activation (credit: massgravel)
if ($act -eq 'y') {
Write-Host "Activating Windows..." -F Green
irm https://raw.githubusercontent.com/ShadowElixir/VariousScripts/refs/heads/main/scripts/act.ps1 | iex
}
if ($esu -eq 'y') {
Write-Host "Activating ESU..." -F Green
irm https://raw.githubusercontent.com/ShadowElixir/VariousScripts/refs/heads/main/scripts/act-esu.ps1 | iex
}
# Install WinGet if not installed
Write-Host "Installing WinGet..." -F Green
Install-PackageProvider -Name NuGet -Force
Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
Repair-WinGetPackageManager -AllUsers
# Essential programs
Write-Host "Installing Programs..." -F Green
winget install -e --id Romanitho.Winget-AutoUpdate --accept-package-agreements --accept-source-agreements --custom "USERCONTEXT=1 UPDATESINTERVAL=Daily"
winget install -e --id Fastfetch-cli.Fastfetch --accept-package-agreements --accept-source-agreements
winget install -e --id yt-dlp.yt-dlp --accept-package-agreements --accept-source-agreements
winget install -e --id Nickvision.Parabolic --accept-package-agreements --accept-source-agreements
winget install -e --id Notepad++.Notepad++ --accept-package-agreements --accept-source-agreements
winget install -e --id jurplel.qView --accept-package-agreements --accept-source-agreements
winget install -e --id clsid2.mpc-hc --accept-package-agreements --accept-source-agreements
winget install -e --id amir1376.ABDownloadManager --accept-package-agreements --accept-source-agreements
winget install -e --id 7zip.7zip --accept-package-agreements --accept-source-agreements
winget install -e --id LibreWolf.LibreWolf --accept-package-agreements --accept-source-agreements
winget install -e --id Brave.Brave --accept-package-agreements --accept-source-agreements
winget install -e --id OBSProject.OBSStudio --accept-package-agreements --accept-source-agreements
winget install -e --id SumatraPDF.SumatraPDF --accept-package-agreements --accept-source-agreements
winget install -e --id qBittorrent.qBittorrent --accept-package-agreements --accept-source-agreements
winget install -e --id AdrienAllard.FileConverter --accept-package-agreements --accept-source-agreements
winget install -e --id Microsoft.Sysinternals.Autoruns --accept-package-agreements --accept-source-agreements
winget install -e --id Git.Git --accept-package-agreements --accept-source-agreements --custom "/COMPONENTS=gitlfs,scalar,assoc /o:EditorOption=Notepad++"
winget install -e --id Betterbird.Betterbird --accept-package-agreements --accept-source-agreements
winget install -e --id zhongyang219.TrafficMonitor.Lite --accept-package-agreements --accept-source-agreements
winget install -e --id Klocman.BulkCrapUninstaller --accept-package-agreements --accept-source-agreements
winget install -e --id winaero.tweaker --accept-package-agreements --accept-source-agreements
if ([int](Get-CimInstance Win32_OperatingSystem).BuildNumber -ge 22000) {
winget install -e --id valinet.ExplorerPatcher --accept-package-agreements --accept-source-agreements
}
if (Get-WmiObject Win32_VideoController | Where-Object { $_.Name -like "*NVIDIA*" }) {
winget install -e --id TechPowerUp.NVCleanstall --accept-package-agreements --accept-source-agreements
}
# Install basic PowerShell profile
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force
New-Item "$env:userprofile\Documents\WindowsPowerShell" -ItemType Directory
echo 'clear' >> $PROFILE
echo 'echo ""' >> $PROFILE
echo 'fastfetch -c paleofetch --logo "windows 7"' >> $PROFILE
echo 'echo ""' >> $PROFILE
# Debloat script (credit: christitustech)
Write-Host "Debloating Windows..." -F Green
$log = "$env:TEMP\debloat.log"
$p = Start-Process powershell `
-ArgumentList '-Command & ([ScriptBlock]::Create((irm https://github.com/ChrisTitusTech/winutil/releases/download/26.02.18/winutil.ps1))) -Config https://raw.githubusercontent.com/ShadowElixir/PostInstall/refs/heads/main/files/debloat.json -Run' `
-RedirectStandardOutput $log `
-NoNewWindow `
-PassThru
while (-not $p.HasExited) {
if (Test-Path $log) {
$text = Get-Content $log -Raw
if ($text -match "-- Tweaks are Finished ---") {
Stop-Process -Id $p.Id
break
}
}
Start-Sleep 1
}
# Reverting bad choices by debloat script
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System" /v "AllowClipboardHistory" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "DODownloadMode" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" /v "GlobalUserDisabled" /f
# Microsoft Store
if ($store -eq 'y') {
Write-Host "Installing Microsoft Store..." -F Green
wsreset -i
}
else {
Write-Host "Skipped Microsoft Store installation." -F Red
}
# Xbox
if ($xbox -eq 'y') {
Write-Host "Installing Xbox components..." -F Green
winget install "9mv0b5hzvk9z" --source msstore --accept-package-agreements --accept-source-agreements # Xbox App
winget install "9wzdncrd1hkw" --source msstore --accept-package-agreements --accept-source-agreements # Xbox Identity Provider
winget install "9MWPM2CQNLHN" --source msstore --accept-package-agreements --accept-source-agreements # Gaming Services
winget install "9nzkpstsnw4p" --source msstore --accept-package-agreements --accept-source-agreements # Game Bar
winget install "9nknc0ld5nn6" --source msstore --accept-package-agreements --accept-source-agreements # Xbox Live in-game experience
}
else {
Write-Host "Skipped Xbox installation." -F Red
}
# Office
if ($office -eq '1') {
Write-Host "Installing OnlyOffice using WinGet..." -F Green
winget install -e --id ONLYOFFICE.DesktopEditors --accept-package-agreements --accept-source-agreements
}
elseif ($office -eq '2') {
Write-Host "Installing Office Deployment Tool using WinGet..." -F Green
winget install -e --id Microsoft.OfficeDeploymentTool --accept-package-agreements --accept-source-agreements
Write-Host "Installing Office using ODT" -F Green
$odt = if (Test-Path "$Env:ProgramFiles\OfficeDeploymentTool\setup.exe") {
"$Env:ProgramFiles\OfficeDeploymentTool\setup.exe"
} elseif (Test-Path "${Env:ProgramFiles(x86)}\OfficeDeploymentTool\setup.exe") {
"${Env:ProgramFiles(x86)}\OfficeDeploymentTool\setup.exe"
}
if ($odt) { & $odt /configure https://raw.githubusercontent.com/ShadowElixir/PostInstall/refs/heads/main/files/office.xml }
if ($oact -eq 'y') {
Write-Host "Activating Office" -F Green
irm https://raw.githubusercontent.com/ShadowElixir/VariousScripts/refs/heads/main/scripts/act-office.ps1 | iex
}
}
else {
Write-Host "Skipped Office installation." -F Red
}
# Additional Configuration
Write-Host "Configuring Winget-AutoUpdate" -F Blue
Rename-Item "C:\Program Files\Winget-AutoUpdate\config\default_excluded_apps.txt" "C:\Program Files\Winget-AutoUpdate\config\default_excluded_apps_backup.txt" -ErrorAction SilentlyContinue
echo "" > "C:\Program Files\Winget-AutoUpdate\config\default_excluded_apps.txt"
Write-Host "Configuring LibreWolf" -F Blue
New-Item "$env:userprofile\.librewolf" -ItemType Directory
echo 'defaultPref("webgl.disabled", false);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
echo 'defaultPref("privacy.resistFingerprinting", false);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
echo 'defaultPref("browser.translations.enable", false);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
echo 'defaultPref("browser.tabs.groups.enabled", false);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
echo 'defaultPref("identity.fxaccounts.enabled", true);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
echo 'defaultPref("toolkit.legacyUserProfileCustomizations.stylesheets", true);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
if ($cookies -eq 'n') {
echo 'defaultPref("privacy.clearOnShutdown_v2.cookiesAndStorage", false);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
echo 'defaultPref("privacy.sanitize.sanitizeOnShutdown", false);' >> "$env:USERPROFILE\.librewolf\librewolf.overrides.cfg"
}
Start-Process "$Env:ProgramFiles\LibreWolf\librewolf.exe" "https://github.com/ShadowElixir/PostInstall/tree/main#recommendations"
Start-Sleep 2
$librewolf = Get-ChildItem "$env:APPDATA\librewolf\Profiles" -Directory |
Sort-Object { (Get-ChildItem $_.FullName -Recurse -File | Measure-Object).Count } -Descending |
Select-Object -First 1
New-Item -ItemType Directory -Force "$($librewolf.FullName)\chrome" | Out-Null
Invoke-WebRequest "https://raw.githubusercontent.com/MrOtherGuy/firefox-csshacks/refs/heads/master/chrome/compact_extensions_panel.css" `
-OutFile "$($librewolf.FullName)\chrome\userChrome.css"
# End of LibreWolf configuration
Write-Host "PostInstall script completed." -F Green
# Optional
# Clipboard-related
# reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System" /v "AllowCrossDeviceClipboard" /f
# Copilot-related
# reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot" /v "TurnOffWindowsCopilot" /f
# reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "PerformedOneTimeHideOfShowDesktopButtonForCopilot" /f
# reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /f
# If you want to re-enable Microsoft Copilot after running the debloat script,
# After running the above 3 commented commands, run the debloat script,
# Go to the "Tweaks" tab, check "Disable Microsoft Copilot",
# Then click "Undo Selected Tweaks".