-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_scriptv1.5.ps1
More file actions
256 lines (214 loc) · 13.4 KB
/
Copy pathsetup_scriptv1.5.ps1
File metadata and controls
256 lines (214 loc) · 13.4 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
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
<#
.SYNOPSIS
A comprehensive Windows 11 setup, debloat, and privacy script.
.DESCRIPTION
This script performs a wide range of system configurations to optimize performance,
enhance privacy, and create a cleaner user experience. It requires Administrator
privileges to execute correctly.
IMPORTANT:
- Run this script as an Administrator.
- It is highly recommended to create a System Restore Point before executing.
- Review the script and comment out (#) any changes you do not want.
KEY ACTIONS PERFORMED:
- System Performance: Sets High Performance power plan, disables hibernation and USB selective suspend.
- Security & Privacy: Disables UAC (reboot required) and various telemetry/tracking features.
- Bloatware Removal: Uninstalls a wide range of pre-installed apps, including Teams and OneDrive.
- UI & UX Customization:
- Enables Dark Mode and the classic Windows 10 context menu.
- Shows file extensions and the 'This PC' desktop icon.
- Customizes the taskbar: Removes default pins (Edge, Chat, Widgets), disables Copilot, and pins Chrome.
- File System: Creates a C:\Archive directory and specific system files.
- Finalization: Restarts the Windows Explorer shell to apply UI changes, causing the screen to flash.
.NOTES
Author: Gemini (Google AI), Jevon Thompson
Date: July 22, 2025
Requires: Windows PowerShell, Administrator privileges.
#>
#Requires -RunAsAdministrator
#===================================================================================================
# SCRIPT INITIALIZATION
#===================================================================================================
param(
[switch]$NoPause
)
# Step 1: Check for Administrator Privileges
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Warning "Administrator rights required. Please re-run this script as an Administrator."
if (-not $NoPause) {
Read-Host "Press Enter to exit..."
}
exit
}
Write-Host "Administrator privileges confirmed. Starting comprehensive setup script..." -ForegroundColor Green
Start-Sleep -Seconds 2
# Step 2: Helper Functions for Taskbar Customization
function Remove-TaskbarPin {
param([string]$AppName)
try {
$verb = "Unpin from taskbar"
# Access the pinned items via the Shell.Application object for broader compatibility
$shell = New-Object -ComObject Shell.Application
$taskbar = $shell.Namespace("shell:::{0D44E104-A02A-45D6-8554-1488AD504363}")
$pinnedItem = $taskbar.Items() | Where-Object { $_.Name -eq $AppName }
if ($pinnedItem) {
$pinnedItem.Verbs() | Where-Object { $_.Name -eq $verb } | ForEach-Object { $_.DoIt() }
Write-Host "Successfully unpinned '$AppName' from the taskbar." -ForegroundColor Green
} else {
Write-Host "'$AppName' is not currently pinned or could not be found by that name."
}
} catch { Write-Warning "An error occurred while trying to unpin '$AppName': $($_.Exception.Message)" }
}
function Add-TaskbarPin {
param([string]$AppPath)
if (-not (Test-Path $AppPath)) {
Write-Warning "Cannot pin application. Path not found: $AppPath"
return
}
try {
$verb = "Pin to taskbar"
$shell = New-Object -ComObject Shell.Application
$folderPath = Split-Path $AppPath -Parent
$fileName = Split-Path $AppPath -Leaf
$folder = $shell.Namespace($folderPath)
$item = $folder.ParseName($fileName)
if ($item.Verbs() | Where-Object { $_.Name.Replace('&','') -eq $verb }) {
$item.Verbs() | Where-Object { $_.Name.Replace('&','') -eq $verb } | ForEach-Object { $_.DoIt() }
Write-Host "Successfully pinned '$fileName' to the taskbar." -ForegroundColor Green
}
} catch { Write-Warning "An error occurred while trying to pin '$fileName': $($_.Exception.Message)" }
}
#===================================================================================================
# SECTION 1: SYSTEM PERFORMANCE & POWER CONFIGURATION
#---------------------------------------------------------------------------------------------------
Write-Host "`n[SECTION 1] Applying Performance & Power Tweaks..." -ForegroundColor Cyan
# Set High Performance Power Plan
Write-Host " - Setting High Performance Power Plan..."
try {
$highPerformancePlan = Get-CimInstance -ClassName Win32_PowerPlan -Namespace root\cimv2\power | Where-Object { $_.ElementName -like '*High performance*' } | Select-Object -First 1
if ($highPerformancePlan) {
$planGuidOnly = ($highPerformancePlan.InstanceID -split '[{}]')[1]
powercfg.exe /setactive $planGuidOnly
Write-Host " -> Activated High Performance power plan." -ForegroundColor Green
} else { Write-Warning " -> High Performance power plan not found."}
} catch { Write-Warning " -> Error setting High Performance power plan: $($_.Exception.Message)" }
# Disable Hibernation
Write-Host " - Disabling Hibernation..."
try {
powercfg.exe /hibernate off
Write-Host " -> Hibernation successfully disabled." -ForegroundColor Green
} catch { Write-Warning " -> Error disabling hibernation: $($_.Exception.Message)" }
# Disable USB Selective Suspend
Write-Host " - Disabling USB Selective Suspend..."
try {
$activePlan = (Get-CimInstance -ClassName Win32_PowerPlan -Namespace root\cimv2\power | Where-Object { $_.IsActive -eq $true }).InstanceID
$planGuid = ($activePlan -split '[{}]')[1]
$usbSubGroup = "2a737441-1930-4402-8d77-b2bebba308a3"
$usbSuspendSetting = "48e6b7a6-50f5-4782-a5d4-53bb8f07e226"
powercfg -setacvalueindex $planGuid $usbSubGroup $usbSuspendSetting 0
powercfg -setdcvalueindex $planGuid $usbSubGroup $usbSuspendSetting 0
Write-Host " -> USB Selective Suspend disabled for active power plan." -ForegroundColor Green
} catch { Write-Warning " -> Error disabling USB Selective Suspend: $($_.Exception.Message)"}
#===================================================================================================
# SECTION 2: PRIVACY & SECURITY CONFIGURATION
#---------------------------------------------------------------------------------------------------
Write-Host "`n[SECTION 2] Applying Privacy & Security Tweaks..." -ForegroundColor Cyan
# Disable User Account Control (UAC)
Write-Host " - Disabling User Account Control (UAC)..."
Write-Warning " *** SECURITY WARNING: Disabling UAC significantly reduces system security. ***"
Write-Warning " *** A system REBOOT is REQUIRED for this change to take effect! ***"
try {
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value 0 -Type DWORD -Force
Write-Host " -> UAC successfully disabled in registry." -ForegroundColor Green
} catch { Write-Warning " -> Error disabling UAC: $($_.Exception.Message)" }
# Apply Telemetry and Privacy Tweaks
Write-Host " - Applying various privacy and telemetry tweaks..."
try {
# Disable Telemetry
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Value 0 -Force -ErrorAction Stop
# Disable Advertising ID for current user
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Value 0 -Force -ErrorAction Stop
# Disable Tailored experiences with diagnostic data
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Privacy" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -Value 0 -Force -ErrorAction Stop
# Disable feedback notifications
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "DoNotShowFeedbackNotifications" -Value 1 -Force -ErrorAction Stop
Write-Host " -> Privacy tweaks applied successfully." -ForegroundColor Green
} catch { Write-Warning " -> An error occurred while applying privacy tweaks. Some settings may not apply." }
#===================================================================================================
# SECTION 3: UI, EXPLORER, & DESKTOP CUSTOMIZATION
#---------------------------------------------------------------------------------------------------
Write-Host "`n[SECTION 4] Applying UI & Desktop Experience Tweaks..." -ForegroundColor Cyan
# Apply general UI tweaks via registry
Write-Host " - Applying registry-based UI tweaks..."
try {
# Enable Dark Mode
$themePath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
if (-not (Test-Path $themePath)) { New-Item -Path $themePath -Force | Out-Null }
Set-ItemProperty -Path $themePath -Name "AppsUseLightTheme" -Value 0 -Type DWORD -Force
Set-ItemProperty -Path $themePath -Name "SystemUsesLightTheme" -Value 0 -Type DWORD -Force
Write-Host " -> Dark Mode enabled."
# Show File Extensions in File Explorer
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value 0 -Force -ErrorAction Stop
Write-Host " -> File extensions will now be shown."
# Show 'This PC' icon on the Desktop
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Value 0 -Force -ErrorAction Stop
Write-Host " -> 'This PC' icon will be shown on the desktop."
# Use Windows 10 Classic Context Menu
New-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Force | Set-ItemProperty -Name "(Default)" -Value "" -Force
Write-Host " -> Windows 10 classic context menu enabled."
Write-Host " -> General UI tweaks applied successfully." -ForegroundColor Green
} catch {
Write-Warning " -> An error occurred while applying general UI tweaks."
}
# Customize Taskbar
Write-Host " - Customizing Taskbar icons and pins..."
try {
# Remove default icons via registry
$advExplorer = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
Set-ItemProperty -Path $advExplorer -Name "TaskbarMn" -Value 0 -Force # Chat Icon
Set-ItemProperty -Path $advExplorer -Name "TaskbarDa" -Value 0 -Force # Widgets Icon
Set-ItemProperty -Path $advExplorer -Name "ShowCopilotButton" -Value 0 -Force # Copilot Icon
Write-Host " -> Chat, Widgets, and Copilot icons disabled."
# Unpin default apps
Remove-TaskbarPin -AppName "Microsoft Edge"
Remove-TaskbarPin -AppName "Mail"
Remove-TaskbarPin -AppName "Microsoft Store"
# Pin Google Chrome
$chromePath = Get-ChildItem -Path "C:\Program Files", "C:\Program Files (x86)" -Recurse -Filter "chrome.exe" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName
if ($chromePath) { Add-TaskbarPin -AppPath $chromePath } else { Write-Warning " -> Google Chrome not found. Skipping pinning." }
} catch { Write-Warning " -> An error occurred during taskbar customization." }
#===================================================================================================
# SECTION 4: FILE SYSTEM & MISCELLANEOUS SETUP
#---------------------------------------------------------------------------------------------------
Write-Host "`n[SECTION 5] Performing File System Setup..." -ForegroundColor Cyan
# Create C:\Archive Directory
Write-Host " - Creating 'Archive' directory..."
$archivePath = "C:\Archive"
try {
if (-not (Test-Path $archivePath)) {
New-Item -Path $archivePath -ItemType Directory -Force | Out-Null
Write-Host " -> Successfully created directory: $archivePath" -ForegroundColor Green
} else { Write-Host " -> Directory '$archivePath' already exists." }
} catch { Write-Warning " -> Error creating directory at $archivePath: $($_.Exception.Message)" }
# Create Beam Files
Write-Host " - Creating beam files..."
try {
New-Item -Path "C:\Windows\dvnc.wov" -ItemType File -Force -ErrorAction Stop | Out-Null
Write-Host " -> Successfully created empty file: C:\Windows\dvnc.wov" -ForegroundColor Green
New-Item -Path "C:\Windows\system32\dvnc.wov" -ItemType File -Force -ErrorAction Stop | Out-Null
Write-Host " -> Successfully created empty file: C:\Windows\system32\dvnc.wov" -ForegroundColor Green
New-Item -Path "C:\Windows\ProgramFiles\dvnc.wov" -ItemType File -Force -ErrorAction Stop | Out-Null
New-Item -Path "C:\Windows\ProgramFiles (x86)\dvnc.wov" -ItemType File -Force -ErrorAction Stop | Out-Null
} catch { Write-Warning " -> Error creating beam files: $($_.Exception.Message)" }
#===================================================================================================
# FINALIZATION
#===================================================================================================
Write-Host "`nAll tasks completed. Restarting Windows Explorer to apply UI changes..." -ForegroundColor Yellow
Write-Warning "The screen and taskbar will flash briefly. This is expected."
Stop-Process -Name explorer -Force
Write-Host "`n--------------------------------------------------------------------" -ForegroundColor Cyan
Write-Host "Script execution finished." -ForegroundColor Cyan
Write-Warning "A full system RESTART is recommended to apply all changes (especially UAC)."
Write-Host "--------------------------------------------------------------------" -ForegroundColor Cyan
if (-not $NoPause) {
Read-Host "Press Enter to exit..."
}