├── .gitignore
├── Banner.jpg
├── LICENSE.txt
├── README.md
└── W1X Debloat (W10-11).ps1
/.gitignore:
--------------------------------------------------------------------------------
1 | *.psbuild
--------------------------------------------------------------------------------
/Banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdminVin/W1X-Debloat/471d0b3660fb95a69d96825a1731258ab04fe389/Banner.jpg
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | ##################################
2 | # OPEN USE --- NO RESALE LICENSE #
3 | ##################################
4 |
5 | Note:
6 | - This project is intended to be free for all.
7 |
8 | Permitted:
9 | - Use this project for personal or internal business purposes.
10 | - Share it freely without charge.
11 |
12 | Not Permitted:
13 | - Sell, resell, or bundle this code or derivatives for commercial purposes.
14 | - Distribute this project or derivatives for profit.
15 |
16 | Legal:
17 | - This project is provided "as-is" without any warranties.
18 | - The author is not responsible for any damages or losses resulting from its use.
19 | - Use of the name "AdminVin" or associated branding is not permitted without explicit permission.
20 | - © AdminVin 2025. All rights reserved.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # W1X Debloat
2 | 
3 |
4 |
5 | ## What is W1X Debloat?
6 | W1X Debloat is a small PowerShell script that optimizes your Windows 10/11 installation. It removes all bloatware, increases privacy and performance.
7 |
8 | Originally created for personal use to quickly remove bloatware and disable intrusive Microsoft spying. Friends found it helpful, so here you go!
9 |
10 |
11 |
12 | ## How do I get W1X Debloat?
13 | You can download the script here:
14 |
15 | **Windows 10-11**: https://github.com/AdminVin/W1X-Debloat/raw/main/W1X%20Debloat%20(W10-11).ps1
16 |
17 | **Windows 12 (Next Valley)**: TBD
18 |
19 | ____________________________________
20 |
21 | 1. Find your OS link above > Right click > Select "Save link as" > Save to your PC
22 |
23 | 2. Click Start > Search for **PowerShell ISE** > Right Click > Run As Administrator
24 |
25 | 3. File > Open > Browse to the file downloaded "W1X Debloat (W****).ps1" > Click the "Green Arrow" or press F5 to run.
26 |
27 |
28 | ## Donate
29 | Helped your system? Great! --- Sponsor my next coffee? [PayPal](https://www.paypal.com/donate/?hosted_button_id=EZU78ZANFT24C)
30 |
--------------------------------------------------------------------------------
/W1X Debloat (W10-11).ps1:
--------------------------------------------------------------------------------
1 | <#############################################################################################################################>
2 | #region 1.0 - Script Settings
3 | ## Variables
4 | $ErrorActionPreference = "SilentlyContinue"
5 | ## Functions
6 | function Set-Registry {
7 | param (
8 | [string]$Path,
9 | [string]$Name,
10 | [Parameter(ValueFromPipeline = $true)]
11 | [Object]$Value,
12 | [ValidateSet('String','ExpandString','Binary','DWord','MultiString','QWord')]
13 | [string]$Type = 'DWord'
14 | )
15 | # Path Check
16 |
17 | if (-not (Test-Path $Path)) {
18 | $null = New-Item -Path $Path -Force
19 | }
20 | # Item Check
21 | if (-not (Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue)) {
22 | $null = New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $Type -Force
23 | } else {
24 | $null = Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force
25 | }
26 | }
27 | ### Log - Start
28 | $PCName = (Get-CIMInstance CIM_ComputerSystem).Name
29 | $Date = Get-Date
30 | $LogFile = "C:\ProgramData\AV\Cleanup\$PCName.txt"
31 | if (Test-Path -Path "C:\ProgramData\AV\Cleanup") {
32 | } else {
33 | New-Item "C:\ProgramData\AV\Cleanup" -Type Directory | Out-Null
34 | New-Item "C:\ProgramData\AV\Cleanup\$PCName.txt" | Out-Null
35 | }
36 | $Date | Out-File -Append -FilePath $LogFile
37 | Write-Host "1.0 Log: Script started at $Date" -ForegroundColor Green
38 | $Timer = [System.Diagnostics.Stopwatch]::StartNew()
39 | # Free Space - Retrieve Existing Free Space
40 | $FreeSpaceBefore = (Get-PSDrive -Name C).Free / 1GB
41 | Write-Host " - Disk Space Free (before): $("{0:N2} GB" -f $FreeSpaceBefore)" -ForegroundColor Yellow
42 | #endregion
43 |
44 |
45 | <#############################################################################################################################>
46 | #region 2.0 - Diagnostics
47 | Write-Host "`n`n2.0 Diagnostics" -ForegroundColor Green
48 | # Verbose Status Messaging
49 | Set-Registry -Type Dword -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\System" -Name "VerboseStatus" -Value "1"
50 | Write-Host "2.1 Verbose Status Messaging [Enabled]" -ForegroundColor Green
51 | #endregion
52 |
53 |
54 | <#############################################################################################################################>
55 | #region 3.0 Applications
56 | Write-Host "`n`n3.0 Applications" -ForegroundColor Green
57 |
58 | #region Windows 10 - 3.1 Applications - Metro
59 | Write-Host "3.1 Applications - Metro" -ForegroundColor Green
60 | $Apps = @(
61 | "Microsoft.3DBuilder*",
62 | "Microsoft.549981C3F5F10*",
63 | "Microsoft.Appconnector*",
64 | "Microsoft.BingFinance*",
65 | "Microsoft.BingFoodAndDrink*",
66 | "Microsoft.BingHealthAndFitness*",
67 | "Microsoft.BingNews*",
68 | "Microsoft.BingSports*",
69 | "Microsoft.BingTranslator*",
70 | "Microsoft.BingTravel*",
71 | "*Clipchamp*",
72 | "Microsoft.CommsPhone*",
73 | "Microsoft.ConnectivityStore*",
74 | "Microsoft.WindowsFeedbackHub*",
75 | "Microsoft.GetHelp*",
76 | "Microsoft.Getstarted*",
77 | "Microsoft.Messaging*",
78 | "Microsoft.Microsoft3DViewer*",
79 | "Microsoft.MicrosoftOfficeHub*",
80 | "Microsoft.MicrosoftPowerBIForWindows*",
81 | "Microsoft.MixedReality.Portal*",
82 | "Microsoft.NetworkSpeedTest*",
83 | "Microsoft.Office.Sway*",
84 | "Microsoft.OneConnect*",
85 | "Microsoft.People*",
86 | "Microsoft.Print3D*",
87 | "Microsoft.MicrosoftSolitaireCollection",
88 | "Microsoft.SkypeApp*",
89 | "MicrosoftTeams*",
90 | "Microsoft.Todos*",
91 | "Microsoft.Wallet*",
92 | "Microsoft.Whiteboard*",
93 | "MicrosoftWindows.Client.WebExperience",
94 | "Microsoft.WindowsMaps*",
95 | "*maps*",
96 | "Microsoft.WindowsPhone*",
97 | "Microsoft.WindowsReadingList*",
98 | "Microsoft.YourPhone*",
99 | "Microsoft.ZuneMusic*",
100 | "Microsoft.ZuneVideo*",
101 | "*ACGMediaPlayer*",
102 | "*ActiproSoftwareLLC*",
103 | "*AdobePhotoshopExpress*",
104 | "*Amazon.com.Amazon*",
105 | "*Asphalt8Airborne*",
106 | "*AutodeskSketchBook*",
107 | "*BubbleWitch3Saga*",
108 | "*CaesarsSlotsFreeCasino*",
109 | "*CandyCrush*",
110 | "*COOKINGFEVER*",
111 | "*CyberLinkMediaSuiteEssentials*",
112 | "*Disney*",
113 | "*DrawboardPDF*",
114 | "*Duolingo-LearnLanguagesforFree*",
115 | "*EclipseManager*",
116 | "*FarmVille2CountryEscape*",
117 | "*FitbitCoach*",
118 | "*Flipboard*",
119 | "*HiddenCity*",
120 | "*Hulu*",
121 | "*iHeartRadio*",
122 | "*Keeper*",
123 | "*Kindle*",
124 | "*LinkedInforWindows*",
125 | "*MarchofEmpires*",
126 | "*NYTCrossword*",
127 | "*OneCalendar*",
128 | "*Pandora*",
129 | "*PhototasticCollage*",
130 | "*PicsArt-PhotoStudio*",
131 | "*PolarrPhotoEditorAcademicEdition*",
132 | "*Prime*",
133 | "*RoyalRevolt*",
134 | "*Shazam*",
135 | "*Sidia.LiveWallpaper*",
136 | "*SlingTV*",
137 | "*Speed",
138 | "*Sway*",
139 | "*TuneInRadio*",
140 | "*Twitter*",
141 | "*Viber*",
142 | "*WinZipUniversal*",
143 | "*Wunderlist*",
144 | "*XING*",
145 | "SAMSUNGELECTRONICSCO.LTD.1412377A9806A*",
146 | "SAMSUNGELECTRONICSCO.LTD.NewVoiceNote*",
147 | "SAMSUNGELECTRONICSCoLtd.SamsungNotes*",
148 | "SAMSUNGELECTRONICSCoLtd.SamsungFlux*",
149 | "SAMSUNGELECTRONICSCO.LTD.StudioPlus*",
150 | "SAMSUNGELECTRONICSCO.LTD.SamsungWelcome*",
151 | "SAMSUNGELECTRONICSCO.LTD.SamsungUpdate*",
152 | "SAMSUNGELECTRONICSCO.LTD.SamsungSecurity1.2*",
153 | "SAMSUNGELECTRONICSCO.LTD.SamsungScreenRecording*",
154 | "SAMSUNGELECTRONICSCO.LTD.SamsungQuickSearch*",
155 | "SAMSUNGELECTRONICSCO.LTD.SamsungPCCleaner*",
156 | "SAMSUNGELECTRONICSCO.LTD.SamsungCloudBluetoothSync*",
157 | "SAMSUNGELECTRONICSCO.LTD.PCGallery*",
158 | "SAMSUNGELECTRONICSCO.LTD.OnlineSupportSService*",
159 | "4AE8B7C2.BOOKING.COMPARTNERAPPSAMSUNGEDITION*"
160 | )
161 | foreach ($App in $Apps) {
162 | Write-Host " - Removed: "$App -ForegroundColor Green
163 | Get-AppxPackage -AllUsers $App | Remove-AppxPackage
164 | }
165 |
166 | # Microsoft Store - Disable SILENT installation of NEW third party apps.
167 | Set-Registry -Type DWord -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Value "0"
168 | Set-Registry -Type DWord -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "ContentDeliveryAllowed" -Value "0"
169 | Set-Registry -Type DWord -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContentEnabled" -Value "0"
170 | # Disable future automatic installs/re-installs of factory/OEM Metro Apps.
171 | Set-Registry -Type DWord -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Value "0"
172 | Set-Registry -Type String -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEverEnabled" -Value "0"
173 | Set-Registry -Type DWord -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OEMPreInstalledAppsEnabled" -Value "0"
174 | # Start Menu - Disable Metro app suggestions.
175 | Set-Registry -Type DWord -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Value "0"
176 | #endregion
177 |
178 |
179 | #region Windows 10/11 - Applications - Desktop
180 | Write-Host "3.2 Applications - Desktop" -ForegroundColor Green
181 | # 3.2.1 Edge
182 | Write-Host "3.2.1 Microsoft Edge" -ForegroundColor Green
183 | ## Services
184 | Get-Service "edgeupdate" | Stop-Service -ErrorAction SilentlyContinue
185 | Get-Service "edgeupdate" | Set-Service -StartupType Disabled -ErrorAction SilentlyContinue
186 | Remove-Item -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Services\edgeupdate" -Recurse -Confirm:$false -Force
187 | Get-Service "edgeupdatem" | Stop-Service -ErrorAction SilentlyContinue
188 | Get-Service "edgeupdatem" | Set-Service -StartupType Disabled -ErrorAction SilentlyContinue
189 | Remove-Item -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Services\edgeupdatem" -Recurse -Confirm:$false -Force
190 | Write-Host "Microsoft Edge - Auto Update Services [DISABLED]" -ForegroundColor Green
191 | Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name LIKE '%Microsoft Search in Bing%'" | ForEach-Object { $_.Uninstall() > $null 2>&1 }
192 | Write-Host "Microsoft Edge - Bloat Search Application [REMOVED]" -ForegroundColor Green
193 | ## Scheduled Tasks
194 | Get-Scheduledtask "*edge*" | Disable-ScheduledTask | Out-Null
195 | Write-Host "Microsoft Edge - Auto Start - Scheduled Task [DISABLED]" -ForegroundColor Green
196 | ## Auto Start
197 | Set-Location HKLM:
198 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Policies\Microsoft") -ne $true) {New-Item "HKLM:\SOFTWARE\Policies\Microsoft" -Force | Out-Null}
199 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge") -ne $true) {New-Item "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge" -Force | Out-Null}
200 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main") -ne $true) {New-Item "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main" -Force | Out-Null}
201 | New-ItemProperty -LiteralPath "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main" -Name "AllowPrelaunch" -Value "0" -PropertyType DWord -Force | Out-Null
202 | Set-Location HKCU:
203 | Set-Location "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run\"
204 | Remove-ItemProperty -Path . -Name "*MicrosoftEdge*" -Force | Out-Null
205 | Set-Location "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
206 | Remove-ItemProperty -Path . -Name "*MicrosoftEdge*" -Force | Out-Null
207 | Set-Location C:/
208 | Write-Host "Microsoft Edge - Auto Start - Startup Entry [DISABLED]" -ForegroundColor Green
209 | # Tracking
210 | Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main' -Name 'DoNotTrack' -Value '1'
211 | Write-Host "Microsoft Edge - Tracking [DISABLED]" -ForegroundColor Green
212 |
213 | # 3.2.2 OneDrive
214 | Write-Host "3.2.2 One Drive" -ForegroundColor Green
215 | # Detect if One Drive is signed in and syncing. ($True = Yes & Do Not Remove)
216 | if (Test-Path $env:OneDrive) {
217 | if (-not (Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive')) {
218 | New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Force | Out-Null
219 | }
220 | # DisableFileSync
221 | if ($null -eq (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSync' -ErrorAction SilentlyContinue)) {
222 | New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSync' -Value 0 -PropertyType DWord -Force | Out-Null
223 | } else {
224 | Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSync' -Value 0 | Out-Null
225 | }
226 |
227 | # DisableFileSyncNGSC
228 | if ($null -eq (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -ErrorAction SilentlyContinue)) {
229 | New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -Value 0 -PropertyType DWord -Force | Out-Null
230 | } else {
231 | Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -Value 0 | Out-Null
232 | }
233 | Write-Host "3.2.2 Microsoft One Drive Removal [Skipped]" -ForegroundColor Yellow
234 | } else {
235 | # Detect if One Drive is signed in and syncing. ($False = No & Remove)
236 | ## Close OneDrive (if running in background)
237 | taskkill /f /im OneDrive.exe
238 | taskkill /f /im FileCoAuth.exe
239 |
240 | ## Official Removal
241 | # x86
242 | Start-Process -FilePath "$Env:WinDir\System32\OneDriveSetup.exe" -WorkingDirectory "$Env:WinDir\System32\" -ArgumentList "/uninstall" | Out-Null
243 | # x64
244 | Start-Process -FilePath "$Env:WinDir\SysWOW64\OneDriveSetup.exe" -WorkingDirectory "$Env:WinDir\SysWOW64\" -ArgumentList "/uninstall" | Out-Null
245 |
246 | ## Files Cleanup
247 | # File Explorer - Navigation Bar
248 | if((Test-Path -LiteralPath "HKCU:\Software\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}") -ne $true) {New-Item "HKCU:\Software\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Force | Out-Null}
249 | New-ItemProperty -LiteralPath 'HKCU:\Software\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Name '(default)' -Value 'OneDrive' -PropertyType String -Force | Out-Null
250 | New-ItemProperty -LiteralPath 'HKCU:\Software\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Name 'System.IsPinnedToNameSpaceTree' -Value "0" -PropertyType DWord -Force | Out-Null
251 | # AppData / Local
252 | Remove-Item -Path "$env:localappdata\OneDrive" -Recurse -Confirm:$false -Force
253 | # ProgramData
254 | Remove-Item -Path "$env:programdata\Microsoft OneDrive" -Recurse -Force
255 | # Shortcuts
256 | Remove-Item -Path "$env:userprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" -Force
257 | Remove-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" -Force
258 | # Program Files
259 | Remove-Item -LiteralPath "C:\Program Files (x86)\Microsoft OneDrive" -Recurse -Confirm:$false -Force
260 | Remove-Item -LiteralPath "C:\Program Files\Microsoft OneDrive" -Recurse -Confirm:$false -Force
261 |
262 | ## Scheduled Tasks
263 | Get-ScheduledTask "*OneDrive*" | Unregister-ScheduledTask -Confirm:$false
264 |
265 | ## Services
266 | $ODUPdaterService = Get-WmiObject -Class Win32_Service -Filter "Name='OneDrive Updater Service'"
267 | $ODUPdaterService.delete() | Out-Null
268 |
269 | ## Registry
270 | # Remove Previous Accounts/Sync Options
271 | Remove-Item -LiteralPath "HKCU:\Software\Microsoft\OneDrive" -Recurse -Confirm:$false -Force
272 | # Remove previously set One Drive settings
273 | Remove-Item -LiteralPath "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Recurse -Confirm:$false -Force
274 | # Remove Right Click Menu Context Options
275 | Remove-Item -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Services\FileSyncHelper" -Recurse -Confirm:$false -Force
276 | # Remove from 'Default' user account
277 | reg load "hku\Default" "C:\Users\Default\NTUSER.DAT"
278 | reg delete "HKEY_USERS\Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f
279 | reg unload "hku\Default"
280 | #########################################
281 | ### DISABLE ONE DRIVE FROM BEING USED ###
282 | #########################################
283 | if (-not (Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive')) {
284 | New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Force | Out-Null
285 | }
286 | # DisableFileSync
287 | if ($null -eq (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSync' -ErrorAction SilentlyContinue)) {
288 | New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSync' -Value 1 -PropertyType DWord -Force | Out-Null
289 | } else {
290 | Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSync' -Value 1 | Out-Null
291 | }
292 | # DisableFileSyncNGSC
293 | if ($null -eq (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -ErrorAction SilentlyContinue)) {
294 | New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -Value 1 -PropertyType DWord -Force | Out-Null
295 | } else {
296 | Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -Value 1 | Out-Null
297 | }
298 | Set-ItemProperty -Path "HKLM\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSync" -Value "1" | Out-Null
299 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive' -Name 'DisableFileSyncNGSC' -Value "1" -PropertyType DWord -Force -ErrorAction SilentlyContinue | Out-Null
300 | Write-Host "3.2.2 Microsoft One Drive [Removed]" -ForegroundColor Yellow
301 | }
302 |
303 | ## 3.2.3 Internet Explorer
304 | Write-Host "3.2.3 Internet Explorer" -ForegroundColor Green
305 | # Addon 'Send to One Note'
306 | Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Extensions\{2670000A-7350-4f3c-8081-5663EE0C6C49}" -Force | Out-Null
307 | Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Extensions\{2670000A-7350-4f3c-8081-5663EE0C6C49}" -Force | Out-Null
308 | Write-Host "Internet Explorer - Addon - 'Send to One Note' [REMOVED]" -ForegroundColor Green
309 | # Addon 'OneNote Linked Notes'
310 | Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Extensions\{789FE86F-6FC4-46A1-9849-EDE0DB0C95CA}" -Force | Out-Null
311 | Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Extensions\{789FE86F-6FC4-46A1-9849-EDE0DB0C95CA}" -Force | Out-Null
312 | Write-Host "Internet Explorer - Addon - 'OneNote Linked Notes' [REMOVED]" -ForegroundColor Green
313 | # Addon 'Lync Click to Call'
314 | Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Extensions\{31D09BA0-12F5-4CCE-BE8A-2923E76605DA}" -Force | Out-Null
315 | Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{31D09BA0-12F5-4CCE-BE8A-2923E76605DA}" -Force | Out-Null
316 | Write-Host "Internet Explorer - Addon - 'Lync Click to Call' [REMOVED]" -ForegroundColor Green
317 | # Addon IE to Edge Browser Helper Object
318 | $existingTask = Get-ScheduledTask | Where-Object { $_.TaskName -like "Internet Explorer - IEtoEDGE Addon Removal" }
319 | if ($null -eq $existingTask) {
320 | Get-ChildItem -Path "C:\Program Files (x86)\Microsoft\Edge\Application" -Recurse -Filter "BHO" | Remove-Item -Force -Recurse
321 | $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "Get-ChildItem -Path 'C:\Program Files (x86)\Microsoft\Edge\Application' -Recurse -Filter 'BHO' | Remove-Item -Force -Recurse"
322 | $trigger = New-ScheduledTaskTrigger -AtLogOn
323 | $STPrin = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount
324 | Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Internet Explorer - IEtoEDGE Addon Removal" -Description "Removes the Internet Explorer Addon IEtoEDGE. This will permit the use of Internet Explorer." -Principal $STPrin | Out-Null
325 | }
326 | Write-Host "Microsoft Edge - Addon: IE to Edge [DISABLED]" -ForegroundColor Green
327 | Write-Host "Internet Explorer - Addon - 'IE to Edge' [REMOVED]" -ForegroundColor Green
328 |
329 | ## 3.2.4 One Note
330 | Write-Host "3.2.4 One Note" -ForegroundColor Green
331 | Remove-Item -LiteralPath "C:\Users\$env:username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Send to OneNote.lnk" -Force | Out-Null
332 | Write-Host "OneNote - 'Send to OneNote' [REMOVED]" -ForegroundColor Green
333 |
334 | ## 3.2.5 Mozilla Firefox
335 | Write-Host "3.2.5 Mozilla Firefox" -ForegroundColor Green
336 | # Scheduled Tasks
337 | Get-ScheduledTask "*Firefox Default*" | Unregister-ScheduledTask -Confirm:$false
338 | Write-Host "Firefox - 'Periodic requests to set as default browser' [DISABLED]" -ForegroundColor Green
339 |
340 | ## 3.2.6 Teams (Home / Small Business)
341 | Write-Host "3.2.6 Teams (Home / Small Business)" -ForegroundColor Green
342 | New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarMn' -Value '0' -PropertyType DWord -Force | Out-Null
343 | Set-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarMn' -Value '0' -Force | Out-Null
344 | Write-Host "Teams (Home / Small Business) - Taskbar Shortcut [REMOVED]" -ForegroundColor Green
345 |
346 | ## 3.2.7 Teams (Work or School)
347 | Write-Host "3.2.7 Teams (Work or School) - Disabled Auto Start" -ForegroundColor Green
348 | Remove-ItemProperty -LiteralPath "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "com.squirrel.Teams.Teams" -Force
349 | Remove-ItemProperty -LiteralPath "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" -Name "TeamsMachineInstaller" -Force
350 | Write-Host "Teams (Work or School) - Auto Start [DISABLED]" -ForegroundColor Green
351 |
352 | ## 3.2.8 Tips/Ticks/Suggestions Pop Ups
353 | Write-Host "3.2.8 Tips/Ticks/Suggestions Pop Ups" -ForegroundColor Green
354 | # Source: https://www.elevenforum.com/t/disable-ads-in-windows-11.8004/
355 | # Settings App Suggestions
356 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338393Enabled" -Value 0 | Out-Null
357 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353694Enabled" -Value 0 | Out-Null
358 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353696Enabled" -Value 0 | Out-Null
359 | Write-Host "Settings App Suggestions [DISABLED]" -ForegroundColor Green
360 | # Windows Tips/Suggestions
361 | Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Value 0 | Out-Null
362 | Write-Host "Windows Tips [DISABLED]" -ForegroundColor Green
363 | # Windows 'Get most of out this device' Suggestions
364 | New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement" -Force | Out-Null
365 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement" -Name "ScoobeSystemSettingEnabled" -Value 0 | Out-Null
366 | Write-Host "Windows 'Getting most out of this device' [DISABLED]" -ForegroundColor Green
367 | # Windows Welcome Experience
368 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-310093Enabled" -Value 0 | Out-Null
369 | Write-Host "Windows 'Welcome' Experience [DISABLED]" -ForegroundColor Green
370 | # Personalized Ads
371 | New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Force | Out-Null
372 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Value 1 | Out-Null
373 | Write-Host "Windows Personalized Ads [DISABLED]" -ForegroundColor Green
374 | # Tailored Experience
375 | New-Item -Path "HKCU:\Software\Policies\Microsoft\Windows\CloudContent" -Force | Out-Null
376 | Set-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Value 1 | Out-Null
377 | Write-Host "Windows Tailored Experience [DISABLED]" -ForegroundColor Green
378 |
379 | ## 3.2.9 Sysinternals Installation
380 | Write-Host "3.2.9 Sysinternals" -ForegroundColor Green
381 | New-Item "C:/users/$env:username/Temp/" -ItemType Directory
382 | Invoke-WebRequest -Uri "https://download.sysinternals.com/files/PSTools.zip" -OutFile "C:/users/$env:username/PSTools.zip"
383 | Expand-Archive -Path "C:/users/$env:username/PSTools.zip" -DestinationPath "C:\Windows\System32" -Force
384 | Remove-Item "C:/users/$env:username/PSTools.zip" -Force
385 | Write-Host "Sysinternals Suite [INSTALLED]" -ForegroundColor Green
386 | Write-Host "Official Website: https://learn.microsoft.com/en-us/sysinternals/" -ForegroundColor Green
387 |
388 | ## 3.3.0 Cortana
389 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCloudSearch" -Value "0" -Force | Out-Null
390 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -Value "0" -Force | Out-Null
391 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortanaAboveLock" -Value "0" -Force | Out-Null
392 | Get-AppxPackage -AllUsers Microsoft.549981C3F5F10 | Remove-AppxPackage | Out-Null
393 | Write-Host "3.3.0 Explorer: Cortana [DISABLED]" -ForegroundColor Green
394 |
395 | ## 3.4.0 Dynamic Lighting
396 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Lighting" -Name "AmbientLightingEnabled" -Value "0"
397 | Write-Host "3.4.0 Microsoft Dynamic Lighting (RGB Fix) [Disabled]" -ForegroundColor Green
398 | #endregion
399 |
400 | #endregion
401 |
402 |
403 | <#############################################################################################################################>
404 | #region 4.0 - Services and Scheduled Tasks
405 | Write-Host "`n`n4.0 Services and Scheduled Tasks" -ForegroundColor Green
406 | ## Services
407 | Write-Host "4.1 Services" -ForegroundColor Green
408 | # Services - Disable
409 | $services = @(
410 | "MapsBroker", # Bing Downloaded Maps Manager
411 | "autotimesvc", # Celluar Time
412 | "WpcMonSvc", # Parental Controls
413 | "PhoneSvc", # Phone Service
414 | "WPDBusEnum", # Portable Device Enumerator Service
415 | "PcaSvc", # Program Compatibility Assistant Service
416 | "RemoteRegistry", # Remote Registry
417 | "RetailDemo", # Retail Demo
418 | "Themes", # Themes
419 | "wisvc", # Windows Insider Service
420 | "icssvc", # Windows Mobile Hotspot Service
421 | "DiagTrack", # Windows Connected User Experiences and Telemetry (InTune related / Does not break sync)
422 | "WerSvc", # Windows Error Reporting Service
423 | "WMPNetworkSvc", # Windows Media Player Network Share
424 | "MixedRealityOpenXRSvc", # Windows Mixed Reality OpenXR Service
425 | "WpnService", # Windows Push Notification System Service
426 | "CscService" # Windows Offline Files
427 | )
428 |
429 | foreach ($service in $services) {
430 | $serviceName = (Get-Service $service).DisplayName
431 | Get-Service $service | Stop-Service -ErrorAction SilentlyContinue
432 | Get-Service $service | Set-Service -StartupType Disabled -ErrorAction SilentlyContinue
433 | Write-Host " - Service: $serviceName [DISABLED]" -ForegroundColor Green
434 | }
435 | # Services - Superfetch/Prefetch Disable (if running SSD)
436 | $disk = Get-PhysicalDisk | Where-Object { $_.DeviceID -eq (Get-Disk -Number (Get-Partition -DriveLetter C).DiskNumber).Number }
437 | if ($disk.MediaType -eq 'SSD' -or $null -eq $disk.MediaType) {
438 | Stop-Service -Name SysMain -Force
439 | Set-Service -Name SysMain -StartupType Disabled
440 | Write-Host " - Service: Superfetch/Prefetch [DISABLED]" -ForegroundColor Green
441 | } else {
442 | Write-Host " - Service: Superfetch/Prefetch [UNMODIFIED (HDD Detected)]" -ForegroundColor Green
443 | }
444 |
445 | # Services - Set to Manual
446 | $services = @(
447 | "BTAGService", # Bluetooth (Setting to Manual in the event BT is used.)
448 | "bthserv" # Bluetooth (Setting to Manual in the event BT is used.)
449 | )
450 |
451 | foreach ($service in $services) {
452 | $serviceName = (Get-Service $service).DisplayName
453 | Get-Service $service | Stop-Service -ErrorAction SilentlyContinue
454 | Get-Service $service | Set-Service -StartupType Manual -ErrorAction SilentlyContinue
455 | Write-Host " - Service: $serviceName [Set to Manual]" -ForegroundColor Green
456 | }
457 |
458 |
459 | ## Scheduled Tasks
460 | Write-Host "4.2 Scheduled Tasks" -ForegroundColor Green
461 | $taskData = @(
462 | @{ TaskName = "Proxy"; DisplayName = "Proxy Task" },
463 | @{ TaskName = "SmartScreenSpecific"; DisplayName = "SmartScreen Specific Task" },
464 | @{ TaskName = "Microsoft Compatibility Appraiser"; DisplayName = "Microsoft Compatibility Appraiser Task" },
465 | @{ TaskName = "Consolidator"; DisplayName = "Consolidator Task" },
466 | @{ TaskName = "KernelCeipTask"; DisplayName = "Kernel CEIP Task" },
467 | @{ TaskName = "UsbCeip"; DisplayName = "USB CEIP Task" },
468 | @{ TaskName = "Microsoft-Windows-DiskDiagnosticDataCollector"; DisplayName = "Disk Diagnostic Data Collector Task" },
469 | @{ TaskName = "GatherNetworkInfo"; DisplayName = "Gather Network Info Task" },
470 | @{ TaskName = "QueueReporting"; DisplayName = "Queue Reporting Task" },
471 | @{ TaskName = "UpdateLibrary"; DisplayName = "Update Library Task" },
472 | @{ TaskName = "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"; DisplayName = "Microsoft Compatibility Appraiser Task" },
473 | @{ TaskName = "Microsoft\Windows\Application Experience\ProgramDataUpdater"; DisplayName = "Program Data Updater Task" },
474 | @{ TaskName = "Microsoft\Windows\Autochk\Proxy"; DisplayName = "Proxy Task" },
475 | @{ TaskName = "Microsoft\Windows\Customer Experience Improvement Program\Consolidator"; DisplayName = "Consolidator Task" },
476 | @{ TaskName = "Microsoft\Windows\Customer Experience Improvement Program\UsbCeip"; DisplayName = "USB CEIP Task" },
477 | @{ TaskName = "Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector"; DisplayName = "Disk Diagnostic Data Collector Task" },
478 | @{ TaskName = "Microsoft\Windows\Maintenance\WinSAT"; DisplayName = "Windows System Assessment Tool" },
479 | @{ TaskName = "Microsoft\Windows\Power Efficiency Diagnostics\AnalyzeSystem"; DisplayName = "Power Efficiency Diagnostics" },
480 | @{ TaskName = "Microsoft\Windows\Windows Error Reporting\QueueReporting"; DisplayName = "Windows Error Reporting Queue" },
481 | @{ TaskName = "Microsoft\Windows\Application Experience\AitAgent"; DisplayName = "Application Experience AIT Agent" }
482 | )
483 |
484 | foreach ($taskInfo in $taskData) {
485 | $taskName = $taskInfo.TaskName
486 | $displayName = $taskInfo.DisplayName
487 |
488 | try {
489 | Disable-ScheduledTask -TaskName $taskName -ErrorAction Stop | Out-Null
490 | Write-Host " - Task: '$displayName' [DISABLED]" -ForegroundColor Green
491 | } catch {
492 | #
493 | }
494 | }
495 | #endregion
496 |
497 | <#############################################################################################################################>
498 | #region 5.0 - Quality of Life
499 | Write-Host "`n`n5.0 Quality of Life" -ForegroundColor Green
500 |
501 | <###################################### EXPLORER TWEAKS (Start) ######################################>
502 |
503 | Add "Open with Powershell 5.1 (Admin)" to Right Click Context Menu
504 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin" -Force | Out-Null}
505 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin\command") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin\command" -Force | Out-Null}
506 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin" -Force | Out-Null}
507 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin\command") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin\command" -Force | Out-Null}
508 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin" -Force | Out-Null}
509 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin\command") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin\command" -Force | Out-Null}
510 | Remove-Item -LiteralPath "HKLM:\SOFTWARE\Classes\LibraryFolder\Background\shell\PowerShellAsAdmin" -Force | Out-Null
511 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System") -ne $true) {New-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Force | Out-Null}
512 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin' -Name '(default)' -Value 'Open with PowerShell (Admin)' -PropertyType String -Force | Out-Null
513 | Remove-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin' -Name 'Extended' -Force | Out-Null
514 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin' -Name 'HasLUAShield' -Value "" -PropertyType String -Force | Out-Null
515 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin' -Name 'Icon' -Value 'powershell.exe' -PropertyType String -Force | Out-Null
516 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShellAsAdmin\command' -Name '(default)' -Value 'powershell -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs powershell.exe -ArgumentList \"-NoExit -Command Push-Location \\\"\"%V/\\\"\"\"' -PropertyType String -Force | Out-Null
517 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin' -Name '(default)' -Value 'Open with PowerShell (Admin)' -PropertyType String -Force | Out-Null
518 | Remove-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin' -Name 'Extended' -Force | Out-Null
519 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin' -Name 'HasLUAShield' -Value "" -PropertyType String -Force | Out-Null
520 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin' -Name 'Icon' -Value 'powershell.exe' -PropertyType String -Force | Out-Null
521 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShellAsAdmin\command' -Name '(default)' -Value 'powershell -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs powershell.exe -ArgumentList \"-NoExit -Command Push-Location \\\"\"%V/\\\"\"\"' -PropertyType String -Force
522 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin' -Name '(default)' -Value 'Open with PowerShell (Admin)' -PropertyType String -Force | Out-Null
523 | Remove-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin' -Name 'Extended' -Force | Out-Null
524 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin' -Name 'HasLUAShield' -Value "" -PropertyType String -Force | Out-Null
525 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin' -Name 'Icon' -Value 'powershell.exe' -PropertyType String -Force | Out-Null
526 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShellAsAdmin\command' -Name '(default)' -Value 'powershell -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs powershell.exe -ArgumentList \"-NoExit -Command Push-Location \\\"\"%V/\\\"\"\"' -PropertyType String -Force | Out-Null
527 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'EnableLinkedConnections' -Value "1" -PropertyType DWord -Force | Out-Null
528 | Write-Host "Explorer: 'Open with PowerShell 5.1 (Admin)' - Right Click Context Menu [ADDED]" -ForegroundColor Green
529 |
530 |
531 | # Add "Open with Powershell 7 (Admin)" to Right Click Context Menu
532 | # Install PS7
533 | if (-not (Test-Path "C:\Program Files\PowerShell\7\pwsh.exe")) {
534 | New-Item -Path "C:\PSTemp" -ItemType Directory | Out-Null
535 | $PS7InstallerPath = "C:\PSTemp\PowerShell-7.msi" # Version 7.3.9
536 | $PS7InstallerURL = "https://github.com/PowerShell/PowerShell/releases/download/v7.5.0/PowerShell-7.5.0-win-x64.msi"
537 | Invoke-WebRequest -Uri $PS7InstallerURL -OutFile $PS7InstallerPath
538 | Start-Process -FilePath msiexec -ArgumentList "/i $PS7InstallerPath /qn" -Wait
539 | Remove-Item -Path "C:\PSTemp" -Recurse -Force | Out-Null
540 | }
541 | # Add to Right Click Context Menu
542 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin" -Force | Out-Null}
543 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin\command") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin\command" -Force | Out-Null}
544 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin" -Force | Out-Null}
545 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin\command") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin\command" -Force | Out-Null}
546 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin" -Force | Out-Null}
547 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin\command") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin\command" -Force | Out-Null}
548 | Remove-Item -LiteralPath "HKLM:\SOFTWARE\Classes\LibraryFolder\Background\shell\PowerShell7AsAdmin" -Force -ErrorAction "SilentlyContinue" | Out-Null
549 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin' -Name '(default)' -Value 'Open with PowerShell 7 (Admin)' -PropertyType String -Force | Out-Null
550 | Remove-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin' -Name 'Extended' -Force -ErrorAction "SilentlyContinue" | Out-Null
551 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin' -Name 'HasLUAShield' -Value "" -PropertyType String -Force | Out-Null
552 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin' -Name 'Icon' -Value 'powershell.exe' -PropertyType String -Force | Out-Null
553 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\Background\shell\PowerShell7AsAdmin\command' -Name '(default)' -Value 'powershell -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs pwsh.exe -ArgumentList \"-NoExit -Command Push-Location \\\"\"%V/\\\"\"\"' -PropertyType String -Force | Out-Null
554 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin' -Name '(default)' -Value 'Open with PowerShell 7 (Admin)' -PropertyType String -Force | Out-Null
555 | Remove-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin' -Name 'Extended' -Force -ErrorAction "SilentlyContinue" | Out-Null
556 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin' -Name 'HasLUAShield' -Value "" -PropertyType String -Force | Out-Null
557 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin' -Name 'Icon' -Value 'pwsh.exe' -PropertyType String -Force | Out-Null
558 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Directory\shell\PowerShell7AsAdmin\command' -Name '(default)' -Value 'powershell -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs pwsh.exe -ArgumentList \"-NoExit -Command Push-Location \\\"\"%V/\\\"\"\"' -PropertyType String -Force | Out-Null
559 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin' -Name '(default)' -Value 'Open with PowerShell 7 (Admin)' -PropertyType String -Force | Out-Null
560 | Remove-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin' -Name 'Extended' -Force -ErrorAction "SilentlyContinue" | Out-Null
561 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin' -Name 'HasLUAShield' -Value "" -PropertyType String -Force | Out-Null
562 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin' -Name 'Icon' -Value 'pwsh.exe' -PropertyType String -Force | Out-Null
563 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Drive\shell\PowerShell7AsAdmin\command' -Name '(default)' -Value 'powershell -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs pwsh.exe -ArgumentList \"-NoExit -Command Push-Location \\\"\"%V/\\\"\"\"' -PropertyType String -Force | Out-Null
564 | Write-Host "Explorer: 'Open with PowerShell 7 (Admin)' - Right Click Context Menu [ADDED]" -ForegroundColor Green
565 |
566 | # Add "Run as Different User" to Right Click Context Menu
567 | Remove-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\exefile\shell\runasuser' -Name 'Extended' -Force | Out-Null
568 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\exefile\shell\runasuser' -Name 'Icon' -Value 'imageres.dll,-5203' -PropertyType String -Force | Out-Null
569 | Write-Host "Explorer: 'Run as different user' - Right Click Context Menu [ADDED]" -ForegroundColor Green
570 |
571 | # Add "Copy as Path" to Right Click Context Menu
572 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\Allfilesystemobjects\shell\windows.copyaspath") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\Allfilesystemobjects\shell\windows.copyaspath" -Force | Out-Null}
573 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Allfilesystemobjects\shell\windows.copyaspath' -Name '(default)' -Value 'Copy &as path' -PropertyType String -Force | Out-Null
574 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Allfilesystemobjects\shell\windows.copyaspath' -Name 'InvokeCommandOnSelection' -Value "1" -PropertyType DWord -Force | Out-Null
575 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Allfilesystemobjects\shell\windows.copyaspath' -Name 'VerbHandler' -Value '{f3d06e7c-1e45-4a26-847e-f9fcdee59be0}' -PropertyType String -Force | Out-Null
576 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Allfilesystemobjects\shell\windows.copyaspath' -Name 'VerbName' -Value 'copyaspath' -PropertyType String -Force | Out-Null
577 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\Allfilesystemobjects\shell\windows.copyaspath' -Name 'Icon' -Value 'imageres.dll,-5302' -PropertyType String -Force | Out-Null
578 | Write-Host "Explorer: 'Copy as Path' - Right Click Context Menu [ADDED]" -ForegroundColor Green
579 |
580 | if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced") -ne $true) {New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Force | Out-Null}
581 | New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'EnableSnapBar' -Value "0" -PropertyType DWord -Force | Out-Null
582 | Write-Host "Explorer: 'Snap Layout' Overlay [DISABLED]" -ForegroundColor Green
583 |
584 | if ((Get-WMIObject win32_operatingsystem) | Where-Object { $_.Name -like "Microsoft Windows 11*" })
585 | {
586 | if((Test-Path -LiteralPath "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32") -ne $true) {New-Item "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Force | Out-Null}
587 | New-ItemProperty -LiteralPath 'HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32' -Name '(default)' -Value "" -PropertyType String -Force | Out-Null
588 | Write-Host "Explorer: Windows 10 - Right Click Context Menu [RESTORED]" -ForegroundColor Green
589 | }
590 |
591 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Classes\*\shell\pintohomefile") -ne $true) {New-Item "HKLM:\SOFTWARE\Classes\*\shell\pintohomefile" -Force | Out-Null}
592 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Classes\*\shell\pintohomefile' -Name 'ProgrammaticAccessOnly' -Value "" -PropertyType String -Force | Out-Null
593 | Write-Host "Explorer: 'Add to Favorites' - Right Click Context Menu [REMOVED]" -ForegroundColor Green
594 |
595 | if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced") -ne $true) {New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -force | Out-Null}
596 | New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'LaunchTo' -Value "1" -PropertyType DWord -Force | Out-Null
597 | Write-Host "Explorer: Set Explorer to open with 'This PC' instead of 'Most Recent'" -ForegroundColor Green
598 |
599 | # Source: https://www.elevenforum.com/t/enable-or-disable-store-activity-history-on-device-in-windows-11.7812/ #Note: Potentially needed for InTune
600 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System") -ne $true) {New-Item "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Force | Out-Null}
601 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' -Name 'PublishUserActivities' -Value "0" -PropertyType DWord -Force | Out-Null
602 | Write-Host "Explorer: Activity Log [DISABLED]" -ForegroundColor Green
603 |
604 | # Source: https://www.makeuseof.com/windows-disable-feedback-notifications/
605 | Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Value "0" -Force | Out-Null
606 | Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "PeriodInNanoSeconds" -Value "0" -Force | Out-Null
607 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Value "1" -Force | Out-Null
608 | Write-Host "Explorer: Feedback Notifications [DISABLED]" -ForegroundColor Green
609 |
610 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value "0" | Out-Null
611 | Write-Host "Explorer: Display of Known File Extensions [ENABLED]" -ForegroundColor Green
612 |
613 | if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer") -ne $true) {New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Force }
614 | New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' -Name 'ShowFrequent' -Value "0" -PropertyType DWord -Force | Out-Null
615 | Write-Host "Explorer: 'Recent Folders' in Quick Access [DISABLED]" -ForegroundColor Green
616 |
617 | # Remove Widgets/Install App Installer (app)/winget
618 | # Reinstall Source: https://apps.microsoft.com/detail/windows-web-experience-pack/9MSSGKG348SP?hl=en-us&gl=US
619 | Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe | Out-Null
620 | winget uninstall --accept-source-agreements "Windows web experience pack" | Out-Null
621 | New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Dsh" -Force | Out-Null
622 | New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Dsh" -Name "AllowNewsAndInterests" -PropertyType DWord -Value 0 -Force | Out-Null
623 | Write-Host "Explorer: Widgets [REMOVED]" -ForegroundColor Green
624 |
625 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' -Name 'DisableLogonBackgroundImage' -Value "1" -PropertyType "DWord" -Force | Out-Null
626 | Write-Host "Explorer: Background on Login Screen [DISABLED]" -ForegroundColor Green
627 |
628 | # Source: https://www.kapilarya.com/disable-tips-and-suggestions-notifications-in-windows-11
629 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableSoftLanding" -Value "1" -Force | Out-Null
630 | Write-Host "Explorer: Tips [DISABLED]" -ForegroundColor Green
631 |
632 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer") -ne $true) {New-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Force | Out-Null}
633 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name 'ShowDriveLettersFirst' -Value 4 -PropertyType DWord -Force | Out-Null
634 | Write-Host "Explorer: Drive letters PRE drive label [Example: '(C:) Windows vs. Windows (C:)]'" -ForegroundColor Green
635 |
636 | # Source: https://documentation.n-able.com/N-central/userguide/Content/Automation/Policies/Diagnostics/pol_UACEnabled_Check.htm
637 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value "0"
638 | Write-Host "Explorer: User Access Control - Prompt for Admins [DISABLED]" -ForegroundColor Green
639 |
640 | Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name "PromptOnSecureDesktop" -Value "0"
641 | Write-Host "Explorer: User Access Control - Desktop Dimming [DISABLED]" -ForegroundColor Green
642 |
643 | Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "AnimateMinimize" -Value "0"
644 | if((Test-Path -LiteralPath "HKCU:\Control Panel\Desktop\WindowMetrics") -ne $true) {New-Item "HKCU:\Control Panel\Desktop\WindowMetrics" -Force}
645 | New-ItemProperty -LiteralPath "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Value "0" -PropertyType String -Force | Out-Null
646 | Write-Host "Explorer: Animations - Window Minimizing [DISABLED]" -ForegroundColor Green
647 |
648 | Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "AnimateWindows" -Value "0"
649 | Write-Host "Explorer: Animations - Window Opening/Closing [DISABLED]" -ForegroundColor Green
650 |
651 | # Settings > Accessibility > Visual Effects > Transparency Effects
652 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "EnableTransparency" -Value "0" | Out-Null
653 | Write-Host "Explorer: Windows Transparency [DISABLED]" ForegroundColor Green
654 |
655 | # Source: https://www.neowin.net/news/microsoft-windows-11-also-haunted-by-this-sata-bios-bug-just-like-windows-7-8-81-and-10/
656 | New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Services\storahci\Parameters\Device' -Name 'TreatAsInternalPort' -Value @("0") -PropertyType MultiString -Force | Out-Null
657 | Write-Host "Explorer: 'Safely Remove and Eject Media' for Intenal Drives [DISABLED]" -ForegroundColor Green
658 |
659 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Value "0" -Force | Out-Null
660 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableSmartScreen" -Value "0" -Type DWORD -Force | Out-Null
661 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Value "Off" -Force | Out-Null
662 | Write-Host "Explorer: App Smart Screening [DISABLED]" -ForegroundColor Green
663 |
664 | # Source: https://www.elevenforum.com/t/add-or-remove-gallery-in-file-explorer-navigation-pane-in-windows-11.14178/
665 | New-Item -Path "HKCU:\Software\Classes\CLSID\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}" -Force
666 | New-ItemProperty -Path "HKCU:\Software\Classes\CLSID\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}" -Name "System.IsPinnedToNameSpaceTree" -Value 0 -PropertyType DWORD -Force | Out-Null
667 | Write-Host "Explorer: 'Gallery' Shorcut [REMOVED]" -ForegroundColor Green
668 |
669 | New-Item -Path "HKCU:\Software\Policies\Microsoft\Windows\WindowsCopilot" -Force | Out-Null
670 | Set-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\WindowsCopilot" -Name "TurnOffWindowsCopilot" -Value "0" -Force | Out-Null
671 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowCopilotButton" -Value "0" | Out-Null
672 | Write-Host "Explorer: Microsoft Co-Pilot SHORTCUT [REMOVED]" -ForegroundColor Green
673 |
674 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Value "0"
675 | Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Value "0"
676 | Write-Host "Explorer: Game Bar [DISABLED]" -ForegroundColor Green
677 |
678 | # Right Click Context Menu "Convert to JPG"
679 | $key = "HKLM:\SOFTWARE\Classes\SystemFileAssociations\.jfif\shell\ConvertToJPG"
680 | if (!(Test-Path $key)) {
681 | $value = "Convert to JPG"
682 | $command = "powershell.exe Rename-Item -Path '%1' -NewName ('%1.jpg')"
683 | New-Item -Path $key -Force | Out-Null
684 | Set-ItemProperty -Path $key -Name "(Default)" -Value $value
685 | New-ItemProperty -LiteralPath $key -Name 'Icon' -Value 'shell32.dll,-16805' -PropertyType String -Force | Out-Null
686 | $commandKey = Join-Path $key "command"
687 | New-Item -Path $commandKey -Force | Out-Null
688 | Set-ItemProperty -Path $commandKey -Name "(Default)" -Value $command
689 | Write-Host "Explorer: File .JFIF to .JPG Conversion [ADDED]" -ForegroundColor Green
690 | } ELSE {
691 | Write-Host "Explorer: File .JFIF to .JPG Conversion [ADDED (Previously)]" -ForegroundColor Green
692 | }
693 |
694 | # Right Click Context Menu "Add Watermark"
695 | $scriptDir = "C:\ProgramData\AV\Watermark"
696 | if (-not (Test-Path -Path $scriptDir)) {
697 | New-Item -Path $scriptDir -ItemType Directory -Force
698 | }
699 |
700 | $scriptContent = @'
701 | Add-Type -AssemblyName System.Drawing
702 |
703 | function Resize-AndAddWatermark {
704 | param (
705 | [string]$imagePath
706 | )
707 |
708 | # Load image
709 | $image = [System.Drawing.Image]::FromFile($imagePath)
710 |
711 | # Resize image
712 | $newWidth = 800
713 | $newHeight = 600
714 | $resizedImage = New-Object System.Drawing.Bitmap $image, $newWidth, $newHeight
715 |
716 | # Create graphics object
717 | $graphics = [System.Drawing.Graphics]::FromImage($resizedImage)
718 | $graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
719 | $graphics.Clear([System.Drawing.Color]::White)
720 |
721 | # Draw the image onto the resized image
722 | $graphics.DrawImage($image, 0, 0, $newWidth, $newHeight)
723 |
724 | # Set watermark text properties
725 | $font = New-Object System.Drawing.Font("Arial", 120, [System.Drawing.FontStyle]::Bold)
726 | $brush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(50, 255, 255, 255)) # Semi-transparent white
727 |
728 | # Draw main centered watermark text
729 | $mainText = "PREVIEW"
730 | $textWidth = $graphics.MeasureString($mainText, $font).Width
731 | $textHeight = $graphics.MeasureString($mainText, $font).Height
732 | $centerX = ($newWidth - $textWidth) / 2
733 | $centerY = ($newHeight - $textHeight) / 2
734 | $graphics.DrawString($mainText, $font, $brush, $centerX, $centerY)
735 |
736 | # Tiled and distorted watermark text
737 | $tileFont = New-Object System.Drawing.Font("Arial", 50, [System.Drawing.FontStyle]::Bold)
738 | $tileBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(30, 255, 255, 255)) # Lighter transparency
739 |
740 | $tileWidth = 200
741 | $tileHeight = 100
742 | for ($y = 0; $y -lt $newHeight; $y += $tileHeight) {
743 | for ($x = 0; $x -lt $newWidth; $x += $tileWidth) {
744 | # Apply random rotation and scaling
745 | $angle = (Get-Random -Minimum -15 -Maximum 15)
746 | $scale = (Get-Random -Minimum 0.8 -Maximum 1.2)
747 |
748 | # Create a transformation matrix
749 | $matrix = New-Object System.Drawing.Drawing2D.Matrix
750 | $matrix.RotateAt($angle, [System.Drawing.PointF]::new($x + $tileWidth / 2, $y + $tileHeight / 2))
751 | $matrix.Scale($scale, $scale)
752 |
753 | # Apply the transformation
754 | $graphics.Transform = $matrix
755 | $graphics.DrawString($mainText, $tileFont, $tileBrush, $x, $y)
756 | $graphics.ResetTransform()
757 | }
758 | }
759 |
760 | # Save the output image
761 | $directory = [System.IO.Path]::GetDirectoryName($imagePath)
762 | $fileName = [System.IO.Path]::GetFileNameWithoutExtension($imagePath)
763 | $outputPath = Join-Path -Path $directory -ChildPath ("$fileName`_resized.jpg")
764 |
765 | $counter = 1
766 | while (Test-Path $outputPath) {
767 | $outputPath = Join-Path -Path $directory -ChildPath ("$fileName`_resized($counter).jpg")
768 | $counter++
769 | }
770 |
771 | $resizedImage.Save($outputPath, [System.Drawing.Imaging.ImageFormat]::Jpeg)
772 |
773 | # Clean up
774 | $graphics.Dispose()
775 | $resizedImage.Dispose()
776 | $image.Dispose()
777 | }
778 |
779 | Resize-AndAddWatermark -imagePath $args[0]
780 | '@
781 |
782 | $scriptPath = Join-Path -Path $scriptDir -ChildPath "ResizeAndAddWatermark.ps1"
783 | $scriptContent | Out-File -FilePath $scriptPath -Force
784 |
785 | $regPathJPG = "HKCU:\Software\Classes\SystemFileAssociations\.jpg\shell\AddWatermark"
786 | $regPathPNG = "HKCU:\Software\Classes\SystemFileAssociations\.png\shell\AddWatermark"
787 |
788 | $regKeys = @($regPathJPG, $regPathPNG)
789 |
790 | foreach ($key in $regKeys) {
791 | if (-not (Test-Path $key)) {
792 | New-Item -Path $key -Force
793 | }
794 |
795 | Set-ItemProperty -Path $key -Name "(Default)" -Value "Add Watermark"
796 |
797 | $commandKeyPath = "$key\command"
798 | if (-not (Test-Path $commandKeyPath)) {
799 | New-Item -Path $commandKeyPath -Force
800 | }
801 |
802 | Set-ItemProperty -Path $commandKeyPath -Name "(Default)" -Value "powershell.exe -ExecutionPolicy Bypass -File `"$scriptPath`" `"%1`""
803 | Set-ItemProperty -Path $key -Name "Icon" -Value "shell32.dll,43"
804 | }
805 | Write-Host "Explorer: .JPG/.PNG 'Add Watermark' [ADDED]" -ForegroundColor Green
806 | <###################################### EXPLORER TWEAKS (End) ######################################>
807 |
808 |
809 |
810 | <###################################### START MENU TWEAKS (Start) ######################################>
811 | if ((Get-WMIObject win32_operatingsystem) | Where-Object { $_.Name -like "Microsoft Windows 11*" }) {
812 | #Source: https://vhorizon.co.uk/windows-11-start-menu-layout-group-policy/
813 | if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced") -ne $true) {New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Force | Out-Null}
814 | New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAl" -Value "0" -Type Dword -Force | Out-Null
815 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAl" -Value "0" -Force | Out-Null
816 | Write-Host "Start Menu: Alignment - Left" -ForegroundColor Green
817 | New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Start_Layout' -Value "1" -PropertyType DWord -Force | Out-Null
818 | Set-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Start_Layout' -Value "1" -Force | Out-Null
819 | Write-Host "Start Menu: Set Layout to reduce 'Recommended Apps'" -ForegroundColor Green
820 | }
821 |
822 | New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -PropertyType "Dword" -Name "ShowTaskViewButton" -Value "0" | Out-Null
823 | Write-host "Start Menu: 'Task View' Button [HIDDEN]" -ForegroundColor Green
824 |
825 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchBoxTaskbarMode" -Value "0" -Type "DWord" -Force | Out-Null
826 | Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchBoxTaskbarMode" -Value "0" -Force | Out-Null
827 | Write-host "Start Menu: 'Search' Button [HIDDEN]" -ForegroundColor Green
828 |
829 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Value "0" -Force | Out-Null
830 | Write-Host "Start Menu: Weather Widget [HIDDEN]" -ForegroundColor Green
831 |
832 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Value "0" -Force | Out-Null
833 | Write-Host "Start Menu: Animations - Icons [DISABLED]" -ForegroundColor Green
834 |
835 | Set-ItemProperty -path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -value "1"
836 | Write-Host "Start Menu: Animations - Appear/Load Time [REDUCED]" -ForegroundColor Green
837 |
838 | # Add 'Devices and Printers' to Start Menu
839 | $ShortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath("CommonPrograms"), "Devices & Printers.lnk")
840 | $WshShell = New-Object -ComObject WScript.Shell
841 | $Shortcut = $WshShell.CreateShortcut($ShortcutPath)
842 | $Shortcut.TargetPath = "shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}"
843 | $Shortcut.Save()
844 | [System.Runtime.Interopservices.Marshal]::ReleaseComObject($WshShell) | Out-Null
845 | Write-Host "Start Menu: 'Devices & Printers' [ADDED]" -ForegroundColor Green
846 |
847 | # Add 'Devices and Printers (Drivers)' to Start Menu
848 | $ShortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath("CommonPrograms"), "Devices & Printers (Drivers).lnk")
849 | $WshShell = New-Object -ComObject WScript.Shell
850 | $Shortcut = $WshShell.CreateShortcut($ShortcutPath)
851 | $Shortcut.TargetPath = "C:\Windows\System32\rundll32.exe"
852 | $Shortcut.Arguments = "printui.dll,PrintUIEntry /s"
853 | $Shortcut.IconLocation = "C:\Windows\System32\imageres.dll,38"
854 | $Shortcut.Save()
855 | [System.Runtime.Interopservices.Marshal]::ReleaseComObject($WshShell) | Out-Null
856 | Write-Host "Start Menu: 'Devices & Printers (Drivers)' [ADDED]" -ForegroundColor Green
857 |
858 | # Add 'Devices and Printers (Add Network Printer)' to Start Menu
859 | $ShortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath("CommonPrograms"), "Devices & Printers (Add Network).lnk")
860 | $WshShell = New-Object -ComObject WScript.Shell
861 | $Shortcut = $WshShell.CreateShortcut($ShortcutPath)
862 | $Shortcut.TargetPath = "C:\Windows\System32\rundll32.exe"
863 | $Shortcut.Arguments = "printui.dll,PrintUIEntry /il"
864 | $Shortcut.IconLocation = "C:\Windows\System32\imageres.dll,39"
865 | $Shortcut.Save()
866 | [System.Runtime.Interopservices.Marshal]::ReleaseComObject($WshShell) | Out-Null
867 | Write-Host "Start Menu: 'Devices & Printers (Add Network)' [ADDED]" -ForegroundColor Green
868 |
869 | <###################################### START MENU TWEAKS (End) ######################################>
870 |
871 |
872 |
873 | <###################################### NETWORK TWEAKS (Start) ######################################>
874 |
875 | $ActiveNetworkAdapter = Get-NetAdapter | Where-Object {$_.Status -eq 'Up'} | Select-Object Name
876 | $ActiveNetworkAdapterConverted = $ActiveNetworkAdapter.Name
877 | Disable-NetAdapterPowerManagement -Name "$ActiveNetworkAdapterConverted" -DeviceSleepOnDisconnect -NoRestart | Out-Null
878 | Write-Host "Network: Ethernet/Wireless Power Saving Settings [DISABLED]" -ForegroundColor Green
879 |
880 | # Source: https://www.majorgeeks.com/content/page/irpstacksize.html (Default 15-20 connections, increased to 50)
881 | if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters") -ne $true) {New-Item "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Force | Out-Null}
882 | New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters' -Name 'IRPStackSize' -Value 48 -PropertyType DWord -Force | Out-Null
883 | Write-Host "Network: Increased Performance for 'I/O Request Packet Stack Size" -ForegroundColor Green
884 |
885 | # Source: https://ttcshelbyville.wordpress.com/2017/10/14/network-throttling-index/
886 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile") -ne $true) {New-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" -Force | Out-Null}
887 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile' -Name 'NetworkThrottlingIndex' -Value -1 -PropertyType DWord -Force | Out-Null
888 | if (-not (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Psched")) {New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Psched" -Force | Out-Null}
889 | New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Psched" -Name "NonBestEffortLimit" -Type Dword -Value "0" | Out-Null
890 | Write-Host "Network: Throttling Index [DISABLED]" -ForegroundColor Green
891 |
892 | <###################################### NETWORK TWEAKS (End) ######################################>
893 |
894 |
895 |
896 | <###################################### WINDOWS TWEAKS (Start) ######################################>
897 |
898 | # Disable 'High Precision Event Timer' to prevent input lag/delays
899 | bcdedit /deletevalue useplatformclock
900 | bcdedit /set useplatformtick yes
901 | bcdedit /set disabledynamictick yes
902 | Write-Host "Windows: Disabled 'High Precision Event Timer' - Formerly Multimedia Timer" -ForegroundColor Green
903 |
904 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games") -ne $true) {New-Item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" -Force | Out-Null}
905 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games' -Name 'GPU Priority' -Value 8 -PropertyType DWord -Force | Out-Null
906 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games' -Name 'Priority' -Value 6 -PropertyType DWord -Force | Out-Null
907 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games' -Name 'Scheduling Category' -Value 'High' -PropertyType String -Force | Out-Null
908 | Write-Host "Windows: Updating 'MMCSS' to prioritize games with higher system resources" -ForegroundColor Green
909 |
910 | if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power") -ne $true) {New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Force | Out-Null}
911 | New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power' -Name 'HiberbootEnabled' -Value "0" -PropertyType DWord -Force | Out-Null
912 | Write-Host "Windows: Disabled Fast Startup - Restored 'Fresh' Reboot" -ForegroundColor Green
913 |
914 | if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management") -ne $true) {New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Force | Out-Null}
915 | New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management' -Name 'ClearPageFileAtShutdown' -Value "1" -PropertyType DWord -Force | Out-Null
916 | Write-Host "Windows: Set paging file to clear at Shutdown" -ForegroundColor Green
917 |
918 | # Source: https://www.thewindowsclub.com/disable-windows-10-startup-delay-startupdelayinmsec (Default=10)
919 | if ((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize") -ne $true) {
920 | New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" -Force | Out-Null
921 | }
922 | if ((Get-ItemProperty -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" -Name "StartupDelayInMSec" -ErrorAction SilentlyContinue) -eq '') {
923 | New-ItemProperty -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" -Name "StartupDelayInMSec" -Value "5" -PropertyType DWord -Force | Out-Null
924 | } else {
925 | Set-ItemProperty -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" -Name "StartupDelayInMSec" -Value "5" -Force | Out-Null
926 | }
927 | Write-Host "Windows: Reduced Startup Delay" -ForegroundColor Green
928 |
929 | # MarkC's Mouse Acceleration Fix (DPI 100% Scale - Default)
930 | # Source: http://donewmouseaccel.blogspot.com/
931 | <# Disable 'Enhance pointer precision' #>
932 | Set-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'MouseSpeed' -Value '0' | Out-Null
933 | Set-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'MouseThreshold1' -Value '0' | Out-Null
934 | Set-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'MouseThreshold2' -Value '0' | Out-Null
935 | Write-Host "Windows: Mouse Acceleration - Disabled Enhance Pointer Precision" -ForegroundColor Green
936 |
937 | $MouseSensitivity = (Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity
938 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 1) {
939 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x1E,0x05,0x00,0x00,0x00,0x00,0x00,0x28,0x3D,0x0A,0x00,0x00,0x00,0x00,0x00,0xBC,0x5B,0x0F,0x00,0x00,0x00,0x00,0x00,0x50,0x7A,0x14,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
940 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0xFF,0xDF,0x00,0x00,0x00,0x00,0x00,0xD8,0xFF,0xBF,0x01,0x00,0x00,0x00,0x00,0xC4,0xFF,0x9F,0x02,0x00,0x00,0x00,0x00,0xB0,0xFF,0x7F,0x03,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
941 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
942 | }
943 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 2) {
944 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAE,0x1E,0x05,0x00,0x00,0x00,0x00,0x00,0x5C,0x3D,0x0A,0x00,0x00,0x00,0x00,0x00,0x0A,0x5C,0x0F,0x00,0x00,0x00,0x00,0x00,0xB8,0x7A,0x14,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
945 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x6F,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0xDF,0x00,0x00,0x00,0x00,0x00,0xFD,0xFF,0x4F,0x01,0x00,0x00,0x00,0x00,0xFC,0xFF,0xBF,0x01,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
946 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
947 | }
948 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 3) {
949 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xD6,0x03,0x00,0x00,0x00,0x00,0x00,0xF8,0xAD,0x07,0x00,0x00,0x00,0x00,0x00,0xF4,0x84,0x0B,0x00,0x00,0x00,0x00,0x00,0xF0,0x5B,0x0F,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
950 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x37,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0x6F,0x00,0x00,0x00,0x00,0x00,0xFD,0xFF,0xA7,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0xDF,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
951 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
952 | }
953 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 4) {
954 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAE,0x1E,0x05,0x00,0x00,0x00,0x00,0x00,0x5C,0x3D,0x0A,0x00,0x00,0x00,0x00,0x00,0x0A,0x5C,0x0F,0x00,0x00,0x00,0x00,0x00,0xB8,0x7A,0x14,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
955 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
956 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
957 | }
958 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 5) {
959 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x66,0x06,0x00,0x00,0x00,0x00,0x00,0xC0,0xCC,0x0C,0x00,0x00,0x00,0x00,0x00,0x20,0x33,0x13,0x00,0x00,0x00,0x00,0x00,0x80,0x99,0x19,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
960 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
961 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
962 | }
963 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 6) {
964 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xAE,0x07,0x00,0x00,0x00,0x00,0x00,0x08,0x5C,0x0F,0x00,0x00,0x00,0x00,0x00,0x0C,0x0A,0x17,0x00,0x00,0x00,0x00,0x00,0x10,0xB8,0x1E,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force
965 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF9,0xFF,0x37,0x00,0x00,0x00,0x00,0x00,0xF2,0xFF,0x6F,0x00,0x00,0x00,0x00,0x00,0xEB,0xFF,0xA7,0x00,0x00,0x00,0x00,0x00,0xE4,0xFF,0xDF,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force
966 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
967 | }
968 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 7) {
969 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB6,0xF5,0x08,0x00,0x00,0x00,0x00,0x00,0x6C,0xEB,0x11,0x00,0x00,0x00,0x00,0x00,0x22,0xE1,0x1A,0x00,0x00,0x00,0x00,0x00,0xD8,0xD6,0x23,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
970 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFA,0xFF,0x37,0x00,0x00,0x00,0x00,0x00,0xF4,0xFF,0x6F,0x00,0x00,0x00,0x00,0x00,0xEE,0xFF,0xA7,0x00,0x00,0x00,0x00,0x00,0xE8,0xFF,0xDF,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
971 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
972 | }
973 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 8) {
974 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0x3D,0x0A,0x00,0x00,0x00,0x00,0x00,0xB8,0x7A,0x14,0x00,0x00,0x00,0x00,0x00,0x14,0xB8,0x1E,0x00,0x00,0x00,0x00,0x00,0x70,0xF5,0x28,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
975 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
976 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
977 | }
978 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 9) {
979 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x85,0x0B,0x00,0x00,0x00,0x00,0x00,0x1C,0x0A,0x17,0x00,0x00,0x00,0x00,0x00,0x2A,0x8F,0x22,0x00,0x00,0x00,0x00,0x00,0x38,0x14,0x2E,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
980 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
981 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
982 | }
983 | IF((Get-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity").MouseSensitivity -eq 10) {
984 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseXCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xCC,0x0C,0x00,0x00,0x00,0x00,0x00,0x80,0x99,0x19,0x00,0x00,0x00,0x00,0x00,0x40,0x66,0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x33,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
985 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Mouse' -Name 'SmoothMouseYCurve' -Value ([byte[]](0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00)) -PropertyType Binary -Force | Out-Null
986 | Write-Host "Windows: Mouse 'Mouse Curve' adjusting to detected sensitivity $MouseSensitivity." -ForegroundColor Green;
987 | }
988 |
989 | # Sticky Keys
990 | if((Test-Path -LiteralPath "HKCU:\Control Panel\Accessibility\StickyKeys") -ne $true) {New-Item "HKCU:\Control Panel\Accessibility\StickyKeys" -Force | Out-Null}
991 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Accessibility\StickyKeys' -Name 'Flags' -Value '506' -PropertyType String -Force | Out-Null
992 |
993 | # Filter Keys
994 | if((Test-Path -LiteralPath "HKCU:\Control Panel\Accessibility\ToggleKeys") -ne $true) {New-Item "HKCU:\Control Panel\Accessibility\ToggleKeys" -Force | Out-Null}
995 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Accessibility\ToggleKeys' -Name 'Flags' -Value '58' -PropertyType String -Force | Out-Null
996 | Write-Host "Windows: Filter & Sticky Keys [DISABLED]" -ForegroundColor Green
997 |
998 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "DisableUAR" -Value "1" -Force | Out-Null
999 | Write-Host "Windows: Troubleshooting 'Steps Recorder' [DISABLED]" -ForegroundColor Green
1000 |
1001 | Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -name "fDenyTSConnections" -value "0" -Force | Out-Null
1002 | Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
1003 | Write-Host "Windows: Remote Desktop [ENABLED]" -ForegroundColor Green
1004 |
1005 | Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -Force | Out-Null
1006 | New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -PropertyType "Dword" -Name "ToastEnabled" -Value "0" | Out-Null
1007 | Write-host "Windows: Toast Notifications [DISABLED]" -ForegroundColor Green
1008 |
1009 | # Lockscreen suggestions/rotating pictures
1010 | if((Test-Path -LiteralPath "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager") -ne $true) {New-Item "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Force | Out-Null}
1011 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SoftLandingEnabled" -Value "0" -PropertyType DWord -Force | Out-Null
1012 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenEnabled" -Value "0" -PropertyType DWord -Force | Out-Null
1013 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenOverlayEnabled" -Value "0" -PropertyType DWord -Force | Out-Null
1014 | Write-Host "Windows: Lockscreen suggestions and rotating pictures [DISABLED]" -ForegroundColor Green
1015 |
1016 | if((Test-Path -LiteralPath "HKCU:\Control Panel\Desktop") -ne $true) {New-Item "HKCU:\Control Panel\Desktop" -Force | Out-Null}
1017 | if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control") -ne $true) {New-Item "HKLM:\SYSTEM\CurrentControlSet\Control" -Force | Out-Null}
1018 | New-ItemProperty -LiteralPath "HKCU:\Control Panel\Desktop" -Name 'ForegroundLockTimeout' -Value "0" -PropertyType DWord -Force | Out-Null
1019 | New-ItemProperty -LiteralPath "HKCU:\Control Panel\Desktop" -Name 'HungAppTimeout' -Value '400' -PropertyType String -Force | Out-Null
1020 | New-ItemProperty -LiteralPath "HKCU:\Control Panel\Desktop" -Name 'WaitToKillAppTimeout' -Value '500' -PropertyType String -Force | Out-Null
1021 | New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control' -Name 'WaitToKillServiceTimeout' -Value '500' -PropertyType String -Force | Out-Null
1022 | Write-Host "Windows: Faster Shutdown [ENABLED]" -ForegroundColor Green
1023 |
1024 | # 'Microsoft from getting to know you'
1025 | if((Test-Path -LiteralPath "HKCU:\SOFTWARE\Policies\Microsoft\Windows\System") -ne $true) {New-Item "HKCU:\SOFTWARE\Policies\Microsoft\Windows\System" -Force | Out-Null}
1026 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Value "0" -PropertyType DWord -Force | Out-Null
1027 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Value "0" -PropertyType DWord -Force | Out-Null
1028 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Value "0" -PropertyType DWord -Force | Out-Null
1029 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Value "0" -PropertyType DWord -Force | Out-Null
1030 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Input\TIPC" -Name "Enabled" -Value "0" -Force | Out-Null
1031 | New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "HistoryViewEnabled" -Value "0" -PropertyType DWord -Force | Out-Null
1032 | Write-Host "Windows: 'Microsoft from getting to know you' [DISABLED]" -ForegroundColor Green
1033 |
1034 | # Split Service Host Threshold for increased reliablity
1035 | # Source: https://www.tenforums.com/tutorials/94628-change-split-threshold-svchost-exe-windows-10-a.html
1036 | $RamInKB = (Get-CimInstance -ClassName Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).Sum / 1KB
1037 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name "SvcHostSplitThresholdInKB" -Value $RamInKB -Force
1038 | Write-Host "Windows: Reduced Service Host Threshold [UPDATED]" -ForegroundColor Green
1039 |
1040 | # Windows Update Delivery Optimization - Disable sending/receiving updates from PCs on local network.
1041 | # Source: https://www.elevenforum.com/t/turn-on-or-off-windows-update-delivery-optimization-in-windows-11.3136
1042 | if((Test-Path -LiteralPath "Registry::\HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Settings") -ne $true) {New-Item "Registry::\HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Settings" -Force | Out-Null}
1043 | New-ItemProperty -LiteralPath 'Registry::\HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Settings' -Name 'DownloadMode' -Value "0" -PropertyType DWord -Force | Out-Null
1044 | Set-ItemProperty -LiteralPath 'Registry::\HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Settings' -Name 'DownloadMode' -Value "0" -Force | Out-Null
1045 | Write-Host "Windows: Update Delivery Optimization - Direct Download [UPDATED]" -ForegroundColor Green
1046 |
1047 | # Windows > Display 'Ease cursor Movement between displays'
1048 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Cursors' -Name 'CursorDeadzoneJumpingSetting' -Value "0" -PropertyType DWord -Force | Out-Null
1049 | Set-ItemProperty -LiteralPath 'HKCU:\Control Panel\Cursors' -Name 'CursorDeadzoneJumpingSetting' -Value "0" -Force | Out-Null
1050 | Write-Host "Windows: 'Ease cursor Movement between displays' [DISABLED]" -ForegroundColor Green
1051 |
1052 | # Windows Background (Spotlight) - Remove "Learn About This Background"
1053 | Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}" -Force
1054 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}" -Value 1
1055 | Write-Host "Windows: Background (Spotlight) - 'Learn About This Background' [REMOVED]" -ForegroundColor Green
1056 |
1057 | # Source: https://www.tomshardware.com/how-to/disable-vbs-windows-11
1058 | # Disable VBS & Device Guard
1059 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "EnableVirtualizationBasedSecurity" -Value 0
1060 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "RequirePlatformSecurityFeatures" -Value 0
1061 | # Disable Credential Guard
1062 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" -Name "RunAsPPL" -Value 0
1063 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" -Name "LsaCfgFlags" -Value 0
1064 | # Disable Memory Integrity (HVCI)
1065 | If (Test-Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity") {
1066 | Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" -Name "Enabled" -Value 0
1067 | }
1068 | Write-Host "Windows: Virtualization-Based Security [DISABLED]" -ForegroundColor Green
1069 |
1070 | New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling" -Force | Out-Null
1071 | New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling" -Name "PowerThrottlingOff" -PropertyType DWord -Value 1 -Force | Out-Null
1072 | Write-Host "Windows: Power Throttling [DISABLED]" -ForegroundColor Green
1073 |
1074 | $VMsRunning = Get-VM | Where-Object { $_.State -eq 'Running' }
1075 | if ($VMsRunning) {
1076 | Write-Host "Windows: Hyper-V [Skipped]" -ForegroundColor Yellow
1077 | } else {
1078 | Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All -NoRestart
1079 | bcdedit /set hypervisorlaunchtype off
1080 | Write-Host "Windows: Hyper-V [DISABLED]" -ForegroundColor Green
1081 | }
1082 | <###################################### WINDOWS TWEAKS (End) ######################################>
1083 |
1084 |
1085 |
1086 | <###################################### TEST TWEAKS (Start) ######################################>
1087 |
1088 | #Set-ItemProperty -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowRecent" -Value "1" -Force | Out-Null
1089 | #Write-Host "Explorer: Disabled 'Recent Files' in Explorer [Skipped]" -ForegroundColor Yellow
1090 |
1091 | #Set-ItemProperty -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackDocs" -Value "1" -Force | Out-Null
1092 | #Write-Host "Explorer: Disabled Recent Files/Folders in Start Menu and Explorer [Skipped]" -ForegroundColor Yellow
1093 |
1094 | <#
1095 | Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'VisualFXSetting' -Value "0"
1096 | Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'VisualFXSetting' -Value 393241
1097 | New-ItemProperty -LiteralPath 'HKCU:\Control Panel\Desktop' -Name 'UserPreferencesMask' -Value ([byte[]](0x10,0x32,0x07,0x80,0x10,0x00,0x00,0x00)) -PropertyType Binary -Force
1098 | Write-Host "Explorer: Set Optimal Visual Settings" -ForegroundColor Green
1099 | #>
1100 |
1101 | <###################################### TEST TWEAKS (Ened) ######################################>
1102 | #endregion
1103 |
1104 |
1105 | <#############################################################################################################################>
1106 | #region 6.0 - Power Settings
1107 | Write-Host "`n`n6.0 Power Settings" -ForegroundColor Green
1108 | Powercfg /Change monitor-timeout-ac 15
1109 | Powercfg /Change monitor-timeout-dc 15
1110 | Write-Host "Sleep Settings: Monitor (Battery: 15 Mins | AC: 15 Mins)" -ForegroundColor Green
1111 |
1112 | Powercfg /Change standby-timeout-ac 0
1113 | Powercfg /Change standby-timeout-dc 60
1114 | Write-Host "Sleep Settings: PC (Battery: 1 Hour | AC: Never)" -ForegroundColor Green
1115 |
1116 | powercfg /Change -disk-timeout-dc 0
1117 | powercfg /Change -disk-timeout-ac 0
1118 | Write-Host "Sleep Settings: Hard Drive (Battery: Never | AC: Never)" -ForegroundColor Green
1119 |
1120 | powercfg /Change -hibernate-timeout-ac 0
1121 | powercfg /Change -hibernate-timeout-dc 0
1122 | powercfg -h off
1123 | Write-Host "Sleep Settings: Hibernate [DISABLED]" -ForegroundColor Green
1124 |
1125 | powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
1126 | powercfg -setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
1127 | Write-Host "Sleep Settings: 'Closing Lid' action to turn off screen" [CHANGED] -ForegroundColor Green
1128 |
1129 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings") -ne $true) {New-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -force | Out-Null}
1130 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings' -Name 'ShowSleepOption' -Value "0" -PropertyType DWord -Force | Out-Null
1131 | New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings' -Name 'ShowHibernateOption' -Value "0" -PropertyType DWord -Force | Out-Null
1132 | Write-Host "Sleep Settings: Sleep/Hibernate from Start Menu [DISABLED]" -ForegroundColor Green
1133 | #endregion
1134 |
1135 |
1136 | <#############################################################################################################################>
1137 | #region 7.0 - Privacy
1138 | Write-Host "`n`n7.0 Privacy" -ForegroundColor Green
1139 | ## Applications
1140 | Write-Host "7.1 Applications" -ForegroundColor Green
1141 | Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Value "Deny" | Out-Null
1142 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Value "Deny" | Out-Null
1143 | Set-Location HKLM:
1144 | New-Item -Path ".SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" | Out-Null
1145 | New-ItemProperty -Path ".SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value "1"
1146 | New-Item -Path ".\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" | Out-Null
1147 | New-ItemProperty -Path ".\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "EnableStatus" -Type DWord -Value "1" | Out-Null
1148 | Write-Host "Applications - Location Permissions [DISABLED]" -ForegroundColor Green
1149 | Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics" -Name "Value" -Value "Deny" | Out-Null
1150 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics" -Name "Value" -Value "Deny" | Out-Null
1151 | Write-Host "Applications - Diagnostics [DISABLED]" -ForegroundColor Green
1152 |
1153 | Write-Host "7.2 Keyboard" -ForegroundColor Green
1154 | # Disable 'Improve inking and typing recognition'
1155 | if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\TextInput\AllowLinguisticDataCollection") -ne $true) {New-Item "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\TextInput\AllowLinguisticDataCollection" | Out-Null};
1156 | New-ItemProperty -LiteralPath "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\TextInput\AllowLinguisticDataCollection" -Name "value" -Value "0" -PropertyType DWord -Force | Out-Null
1157 | if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Input\TIPC") -ne $true) {New-Item "HKCU:\Software\Microsoft\Input\TIPC" -Force | Out-Null};
1158 | New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Input\TIPC' -Name 'Enabled' -Value "0" -PropertyType DWord -Force | Out-Null
1159 | Write-Host "Keyboard - Improved Inking and Typing Reconition [DISABLED]" -ForegroundColor Green
1160 |
1161 | Write-Host "7.3 Clipboard" -ForegroundColor Green
1162 | if((Test-Path -LiteralPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\SmartActionPlatform\SmartClipboard") -ne $true) {New-Item "HKCU:\Software\Microsoft\Windows\CurrentVersion\SmartActionPlatform\SmartClipboard" -Force | Out-Null};
1163 | New-ItemProperty -LiteralPath 'HKCU:\Software\Microsoft\Windows\CurrentVersion\SmartActionPlatform\SmartClipboard' -Name 'Disabled' -Value "1" -PropertyType DWord -Force | Out-Null
1164 | Write-Host "Clipboard - 'Smart Clipboard' [DISABLED]" -ForegroundColor Green
1165 |
1166 | Write-Host "7.4 Telemetry" -ForegroundColor Green #InTune Required
1167 | # Disable Tailored Experiences With Diagnostic Data
1168 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy" -type "Dword" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -Value "0"
1169 | # Disable Telemetry
1170 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value "0" | Out-Null
1171 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "MaxTelemetryAllowed" -Type DWord -Value "0" | Out-Null
1172 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value "0" | Out-Null
1173 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value "0" | Out-Null
1174 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value "0" | Out-Null
1175 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Type DWord -Value "0" | Out-Null
1176 | Write-Host "Windows: Telementry [DISABLED]" -ForegroundColor Green
1177 |
1178 | # Firewall Block
1179 | # Inbound - Check
1180 | $inboundRuleExists = Get-NetFirewallRule -DisplayName "Telementry Block - Inbound" -ErrorAction SilentlyContinue
1181 | # Inbound - Add
1182 | if (-not $inboundRuleExists) {
1183 | netsh advfirewall firewall add rule name="Telementry Block - Inbound" dir=in action=block remoteip=134.170.30.202,137.116.81.24,157.56.106.189,184.86.53.99,2.22.61.43,2.22.61.66,204.79.197.200,23.218.212.69,65.39.117.23,65.55.108.23,64.4.54.254 enable=yes
1184 | }
1185 | # Outbound - Check
1186 | $outboundRuleExists = Get-NetFirewallRule -DisplayName "Telementry Block - Outbound" -ErrorAction SilentlyContinue
1187 | # Outbound - Add
1188 | if (-not $outboundRuleExists) {
1189 | netsh advfirewall firewall add rule name="Telementry Block - Outbound" dir=out action=block remoteip=65.55.252.43,65.52.108.29,191.232.139.254,65.55.252.92,65.55.252.63,65.55.252.93,65.55.252.43,65.52.108.29,194.44.4.200,194.44.4.208,157.56.91.77,65.52.100.7,65.52.100.91,65.52.100.93,65.52.100.92,65.52.100.94,65.52.100.9,65.52.100.11,168.63.108.233,157.56.74.250,111.221.29.177,64.4.54.32,207.68.166.254,207.46.223.94,65.55.252.71,64.4.54.22,131.107.113.238,23.99.10.11,68.232.34.200,204.79.197.200,157.56.77.139,134.170.58.121,134.170.58.123,134.170.53.29,66.119.144.190,134.170.58.189,134.170.58.118,134.170.53.30,134.170.51.190,157.56.121.89,134.170.115.60,204.79.197.200,104.82.22.249,134.170.185.70,64.4.6.100,65.55.39.10,157.55.129.21,207.46.194.25,23.102.21.4,173.194.113.220,173.194.113.219,216.58.209.166,157.56.91.82,157.56.23.91,104.82.14.146,207.123.56.252,185.13.160.61,8.254.209.254,198.78.208.254,185.13.160.61,185.13.160.61,8.254.209.254,207.123.56.252,68.232.34.200,65.52.100.91,65.52.100.7,207.46.101.29,65.55.108.23,23.218.212.69 enable=yes
1190 | }
1191 | Write-Host "Windows: Telementry Internet Connection [DISABLED]" -ForegroundColor Green
1192 | #endregion
1193 |
1194 |
1195 | <#############################################################################################################################>
1196 | #region 8.0 - Space Cleanup
1197 | Write-Host "`n`n8.0 Space Cleanup" -ForegroundColor Green
1198 | function Remove-ItemRecursively {
1199 | param (
1200 | [string]$Path
1201 | )
1202 |
1203 | Get-ChildItem -Path $Path -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
1204 | Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue
1205 | }
1206 | ## Temporary Files
1207 | # Temp - User
1208 | Remove-ItemRecursively -Path "$env:TEMP\*" -Recurse -Force
1209 | Write-Host " - Clearing C:\User\$env:username\Temp" -ForegroundColor Yellow
1210 | # Temp - Windows
1211 | Remove-ItemRecursively -Path "C:\Windows\Temp\*"
1212 | Write-Host " - Clearing C:\Windows\Temp\" -ForegroundColor Yellow
1213 | ## Windows Update
1214 | Write-Host " - Clearing old Windows Updates" -ForegroundColor Yellow
1215 | Write-Host "`n*NOTE* This may take some time and is expected. Especially, if this is the first run the script is running." -ForegroundColor Red
1216 | # SoftwareDistribution
1217 | ## Windows Update
1218 | # SoftwareDistribution
1219 | Stop-Service -Name wuauserv
1220 | if (Test-Path "C:\Windows\SoftwareDistribution.old") {
1221 | cmd.exe /c rd /s /q "C:\Windows\SoftwareDistribution.old"
1222 | } # Remove any .old variations of 'SoftwareDistribution'
1223 | Rename-Item -Path "C:\Windows\SoftwareDistribution" -NewName "SoftwareDistribution.old"
1224 | cmd.exe /c rd /s /q "C:\Windows\SoftwareDistribution.old"
1225 | Start-Service -Name wuauserv
1226 | # WinSxS
1227 | # Service Pack Backups / Superseded Updates / Replaced Componets
1228 | dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
1229 | ## Free Space - Retrieve Updated Free Space
1230 | $FreeSpaceAfter = (Get-PSDrive -Name C).Free / 1GB
1231 | Write-Host "`n - Disk Space Free (after): $("{0:N2} GB" -f $FreeSpaceAfter)" -ForegroundColor Yellow
1232 | Write-Host " - Actual Space Freed: $("{0:N2} GB" -f ($FreeSpaceAfter - $FreeSpaceBefore))" -ForegroundColor Green
1233 |
1234 |
1235 | <#############################################################################################################################>
1236 | #region 9.0 - Script Settings
1237 | ### Log - End
1238 | # Log Locally
1239 | "Script Duration" | Out-File -Append -FilePath $LogFile
1240 | $Timer.Elapsed | Select-Object Hours, Minutes, Seconds | Format-Table | Out-File -Append -FilePath $LogFile
1241 | $Timer.Stop()
1242 | $TimerFinal = $Timer.Elapsed | Select-Object Hours, Minutes, Seconds | Format-Table
1243 | Write-Host "`n`n9.0 Log: Script Duration" -ForegroundColor Green
1244 | $TimerFinal
1245 | Write-Host "Log file located at $LogFile" -ForegroundColor Yellow
1246 | #endregion
1247 |
1248 |
1249 | <#############################################################################################################################>
1250 | #region 9.0 - Notify User / Reboot
1251 | Write-Host " "
1252 | Write-Host " "
1253 | Write-Host "***************************************************************" -ForegroundColor Green
1254 | Write-Host "* *" -ForegroundColor Green
1255 | Write-Host "* W1X Debloat v2.0 has finished! *" -ForegroundColor Green
1256 | Write-Host "* *" -ForegroundColor Green
1257 | Write-Host "***************************************************************" -ForegroundColor Green
1258 | Write-Host "`n PLEASE REBOOT YOUR COMPUTER FOR ALL CHANGES TO TAKE EFFECT.`n" -ForegroundColor Red
1259 | #endregion
--------------------------------------------------------------------------------