-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathWindows_Optimisation_Pack.ps1
More file actions
559 lines (488 loc) · 28.5 KB
/
Windows_Optimisation_Pack.ps1
File metadata and controls
559 lines (488 loc) · 28.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# Windows_Optimisation_Pack @Marvin700
# windows-optimisation.de
### Version ###
$Branch = "main"
$Version = "2.0"
### Title ###
$Host.UI.RawUI.WindowTitle = "Windows_Optimisation_Pack | $([char]0x00A9) Marvin700"
$ScriptFolder = "$env:temp\Windows_Optimisation_Pack"
### Functions ###
$hash = [hashtable]::Synchronized(@{})
function SystemPoint{
Clear-Host
Write-Output " Create System Restore Point"
# Delete all previous restore points when the function is activated
IF($hash.Extended_Cleanup){vssadmin delete shadows /all /quiet | Out-Null}
# Temporarily modify to create a restore point.
Enable-ComputerRestore -Drive $env:SystemDrive
New-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "SystemRestorePointCreationFrequency" -Type "DWORD" -Value 0 -Force | Out-Null
Checkpoint-Computer -Description "Windows_Optimisation_Pack" -RestorePointType MODIFY_SETTINGS
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "SystemRestorePointCreationFrequency" | Out-Null}
function Checks_and_Preperations{
# Checks to Run Script
Clear-Host
Write-Output " Compatibility checks and preparation are performed..."
$WindowsVersion = (Get-WmiObject -Class Win32_OperatingSystem).Caption
IF(!($WindowsVersion -like "Microsoft Windows 11*" -Or $WindowsVersion -like "Microsoft Windows 10*")){
Write-Warning " No supported operating system! Windows 10 or Windows 11 required"
Start-Sleep 20;exit}
IF((Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending")){
Write-Warning " Reboot Pending !"
Start-Sleep 20;exit}
#Regkey for Script
New-Item -Path "HKLM:\SOFTWARE\Windows_Optimisation_Pack\" -Force | Out-Null
Write-Output " Download Github Files..."
# Download ooShutup
New-Item -Path "$ScriptFolder\ooshutup" -ItemType Directory | Out-Null
Start-BitsTransfer -Source "https://raw.githubusercontent.com/Marvin700/Windows_Optimisation_Pack/$Branch/config/ooshutup.cfg" -Destination "$ScriptFolder\ooshutup\ooshutup.cfg"
Start-BitsTransfer -Source "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -Destination "$ScriptFolder\ooshutup\OOSU10.exe"
# Download Sophia Script Windows 10
$LatestGitHubRelease = (Invoke-RestMethod "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases/latest").tag_name
IF($WindowsVersion -match "Microsoft Windows 11"){
$LatestRelease = (Invoke-RestMethod "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json").Sophia_Script_Windows_11_PowerShell_5_1
Start-BitsTransfer -Source "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Destination "$env:temp\Sophia.zip"
Expand-Archive $env:temp\Sophia.zip $env:temp -force
Move-Item -Path $env:temp\"Sophia_Script*" -Destination "$ScriptFolder\Sophia_Script\"
Start-BitsTransfer -Source "https://raw.githubusercontent.com/Marvin700/Windows_Optimisation_Pack/$Branch/config/SophiaScript_Win11.ps1" -Destination "$ScriptFolder\Sophia_Script\Sophia.ps1"}
# Download Sophia Script Windows 11
IF($WindowsVersion -match "Microsoft Windows 10"){
$LatestRelease = (Invoke-RestMethod "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json").Sophia_Script_Windows_10_PowerShell_5_1
Start-BitsTransfer -Source "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Destination "$env:temp\Sophia.zip"
Expand-Archive $env:temp\Sophia.zip $env:temp -force
Move-Item -Path $env:temp\"Sophia_Script*" -Destination "$ScriptFolder\Sophia_Script\"
Start-BitsTransfer -Source "https://raw.githubusercontent.com/Marvin700/Windows_Optimisation_Pack/$Branch/config/SophiaScript_Win10.ps1" -Destination "$ScriptFolder\Sophia_Script\Sophia.ps1"}
}
########## Menu: Optimise Windows ##########
function WindowsTweaks_Services{
# Disable unnecessary tasks
$services = @("WpcMonSvc","SharedRealitySvc","Fax","autotimesvc","wisvc","SDRSVC","MixedRealityOpenXRSvc","WalletService","SmsRouter","SharedAccess","MapsBroker","PhoneSvc"
"ScDeviceEnum","TabletInputService","icssvc","edgeupdatem","edgeupdate","MicrosoftEdgeElevationService","RetailDemo","MessagingService","PimIndexMaintenanceSvc","OneSyncSvc"
"UnistoreSvc","DiagTrack","dmwappushservice","diagnosticshub.standardcollector.service","diagsvc","WerSvc","wercplsupport","SCardSvr","SEMgrSvc")
$services | ForEach-Object {
Stop-Service $_ -ErrorAction SilentlyContinue
Set-Service $_ -StartupType Disabled -ErrorAction SilentlyContinue}}
function WindowsTweaks_Features{
# Disable unnecessary Features
$features = @("TFTP","TelnetClient","WCF-TCP-PortSharing45","SmbDirect","MicrosoftWindowsPowerShellV2Root","Recall"
"Printing-XPSServices-Features","WorkFolders-Client","MSRDC-Infrastructure","MicrosoftWindowsPowerShellV2")
$features | ForEach-Object {dism /Online /Disable-Feature /FeatureName:$_ /NoRestart}
$capability = @("App.StepsRecorder*","App.Support.QuickAssist*","Browser.InternetExplore*","Hello.Face*","MathRecognizer*","Microsoft.Windows.PowerShell.ISE*","OpenSSH*","Language.Handwriting")
foreach($capability in $capability){Get-WindowsCapability -online | where-object {$_.name -like $capability} | Remove-WindowsCapability -online -ErrorAction SilentlyContinue}}
function WindowsTweaks_Tasks{
# Disable unnecessary Tasks
schtasks /change /TN "Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE
schtasks /change /TN "Microsoft\Windows\Application Experience\StartupAppTask" /DISABLE
schtasks /change /TN "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" | Disable-ScheduledTask
$tasks = @("ProgramDataUpdater","Proxy","Consolidator","Microsoft-Windows-DiskDiagnosticDataCollector","MapsToastTask","MapsUpdateTask","FamilySafetyMonitor"
"FODCleanupTask","FamilySafetyRefreshTask","XblGameSaveTask","UsbCeip","DmClient","DmClientOnScenarioDownload")
$tasks | ForEach-Object {Get-ScheduledTask -TaskName $_ -ErrorAction SilentlyContinue | Disable-ScheduledTask -ErrorAction SilentlyContinue}}
function WindowsTweaks_Registry{
# MarkC Mouse Acceleration Fix
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "SmoothMouseXCurve" ([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))
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "SmoothMouseYCurve" ([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))
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity" -Type "DWORD" -Value 10 -Force
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSpeed" -Type "DWORD" -Value 0 -Force
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseTrails" -Type "DWORD" -Value 0 -Force
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseThreshold1" -Type "DWORD" -Value 0 -Force
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseThreshold2" -Type "DWORD" -Value 0 -Force
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type "DWORD" -Value 0 -Force
# Disable Windows Telemetry
Set-ItemProperty -Path "HKLM:\SYSTEM\ControlSet001\Services\DiagTrack" -Name "Start" -Type "DWORD" -Value 4 -Force
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\dmwappushservice" -Name "Start" -Type "DWORD" -Value 4 -Force
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service" -Name "Start" -Type "DWORD" -Value 4 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Value 0 -Type "DWORD" -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type "DWORD" -Value 0 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "LimitEnhancedDiagnosticDataWindowsAnalytics" -Type "DWORD" -Value 0 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" -Name "HideInsiderPage" -Type "DWORD" -Value 1 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\activity" -Name "Value" -Value "Deny" -Force
# Gaming Tweaks
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Dwm" -Name "OverlayTestMode" -Type "DWORD" -Value 00000005 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\" -Name "NetworkThrottlingIndex" -Type "DWORD" -Value 268435455 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\" -Name "SystemResponsiveness" -Type "DWORD" -Value 00000000 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" -Name "Priority" -Type "DWORD" -Value 00000006 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" -Name "Scheduling Category" -Value "High" -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" -Name "SFIO Priority" -Value "High" -Force}
function WindowsTweaks_Index{
# Rename C Drive
Label $env:SystemDrive Windows
# Disable Windows Indexing
$drives = Get-WmiObject Win32_LogicalDisk | Select-Object -ExpandProperty DeviceID
$drives | ForEach-Object{Get-WmiObject -Class Win32_Volume -Filter "DriveLetter='$_'" | Set-WmiInstance -Arguments @{IndexingEnabled=$False}}}
function SophiaScript{
# Start Sophia Script
Powershell.exe -executionpolicy Bypass $ScriptFolder\Sophia_Script\Sophia.ps1}
function ooShutup{
# O&O ShutUp10++
Start-Process powershell "Set-Location $ScriptFolder\ooshutup;.\OOSU10.exe ooshutup.cfg /quiet" -WindowStyle Hidden}
function Clear_Cache{
Clear-Host
Write-Output "Removing Cache Files..."
# Clear DNS Cache
ipconfig /flushdns > $null
Clear-BCCache -Force -ErrorAction SilentlyContinue
# Clear Multiple Cache Foleder
$path = @("$env:windir\..\MSOCache\","$env:windir\Prefetch\","$env:SystemRoot\SoftwareDistribution\Download\","$env:ProgramData\Microsoft\Windows\RetailDemo\","$env:LOCALAPPDATA\CrashDumps\","$env:windir\Temp\","$env:temp\"
"$env:LOCALAPPDATA\NVIDIA\DXCache\","$env:LOCALAPPDATA\NVIDIA\GLCache\","$env:APPDATA\..\locallow\Intel\ShaderCache\","$env:SystemDrive\AMD\","$env:LOCALAPPDATA\AMD\","$env:APPDATA\..\locallow\AMD\","C:\ProgramData\Package Cache")
foreach($path in $path){Get-ChildItem -Path $path -ErrorAction SilentlyContinue | Remove-Item -Recurse -ErrorAction SilentlyContinue}
# Rebuild Performance Couters
lodctr /r}
function Extended_Cleanup{
# Cleanup Windows Components
Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore /NoRestart
Dism.exe /Online /Cleanup-Image /StartComponentCleanup /NoRestart
Dism.exe /Online /Cleanup-Image /spsuperseded /NoRestart
# Maximizes Disk Cleanup settings
ForEach($result in Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"){
If(!($result.name -eq "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\DownloadsFolder")){
New-ItemProperty -Path "'HKLM:' + $result.Name.Substring( 18 )" -Name 'StateFlags0001' -Value 2 -PropertyType DWORD -Force -EA 0}}
Start-Process cleanmgr.exe /sagerun:1}
function Idle_Tasks{
Start-Process -FilePath "cmd.exe" -ArgumentList '/c title Windows_Optimisation_Pack && mode con cols=40 lines=12 && echo Background tasks are processed... && echo This Step can run up to 1 Hour && echo _ && echo You can continue with your stuff :) && %windir%\system32\rundll32.exe advapi32.dll,ProcessIdleTasks'}
########## ###########
function Finish{
# Reg Entry for Pending Reboot
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\" -Name "RebootPending" -Value 1
# Reg Entry for Toast
New-PSDrive -Name "HKCR" -PSProvider Registry -Root "HKEY_CLASSES_ROOT" | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Windows_Optimisation_Pack" -Name "Version" -Type "STRING" -Value $Version -Force | Out-Null
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows_Optimisation_Pack" -Force | Out-Null
New-Item -Path "HKCR:\AppUserModelId\Windows_Optimisation_Pack" -Force | Out-Null
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows_Optimisation_Pack" -Name "ShowInActionCenter" -Type "DWORD" -Value 1 -Force | Out-Null
Set-ItemProperty -Path "HKCR:\AppUserModelId\Windows_Optimisation_Pack" -Name "DisplayName" -Value "Windows_Optimisation_Pack" -Type "STRING" -Force | Out-Null
Set-ItemProperty -Path "HKCR:\AppUserModelId\Windows_Optimisation_Pack" -Name "ShowInSettings" -Value 0 -Type "STRING" -Force | Out-Null
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
# Toast
[xml]$ToastTemplate = @"
<toast duration="Long"><visual><binding template="ToastGeneric">
<text>Your Windows is now debloated and optimised</text></binding></visual>
<audio src="ms-winsoundevent:notification.default" /></toast>
"@
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::New()
$ToastXml.LoadXml($ToastTemplate.OuterXml)
$ToastMessage = [Windows.UI.Notifications.ToastNotification]::New($ToastXML)
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("Windows_Optimisation_Pack").Show($ToastMessage)
exit}
function GUI{
## GUI
# GUI Preperations
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
# Hide Window Function
Add-Type -MemberDefinition '[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);' -Name WinAPI -Namespace User32
$HideWindow = (Get-Process -Id $PID).MainWindowHandle
# Backgroud Color
$DefaultBackColor = '#212121'
$HighlighBackColor = '#333333'
# Logo
IF(!(Test-Path $ScriptFolder)){New-Item -Path $ScriptFolder -ItemType Directory | Out-Null}
else{Get-ChildItem -Path $ScriptFolder -ErrorAction SilentlyContinue | Remove-Item -Recurse -exclude "Logo.png" | Out-Null}
IF(!(Test-Path $ScriptFolder\Logo.png)){Invoke-WebRequest "https://user-images.githubusercontent.com/98750428/232198728-be7449b4-1d64-4f83-9fb1-2337af52b0c2.png" -OutFile "$ScriptFolder\Logo.png"}
$Administrator = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
$WindowsVersion = (Get-WmiObject -Class Win32_OperatingSystem).Caption
$BuildNumber = (Get-CimInstance -Class CIM_OperatingSystem).BuildNumber
#$InternetConnection = (Invoke-WebRequest -Uri https://github.com/Marvin700/Windows_Optimisation_Pack -Method Head -ErrorAction SilentlyContinue).StatusDescription
$PendingReboot = (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending")
# Hide Window
[User32.WinAPI]::ShowWindow($HideWindow, 6)
# GUI Checkbox Buttton Handler (Unverändert)
$hash.Exit = $true
$handler_BUTTON_Start_Click = {
$hash.Exit = $false
IF($BOX_Checks.Checked) {$hash.Checks = $true}
IF($BOX_SystemPoint.Checked) {$hash.SystemPoint = $true}
IF($BOX_SophiaScript.Checked) {$hash.SophiaScript = $true}
IF($BOX_ooShutup.Checked) {$hash.ooShutup = $true}
IF($BOX_WindowsTweaks_Registry.Checked) {$hash.WindowsTweaks_Registry = $true}
IF($BOX_WindowsTweaks_Tasks.Checked) {$hash.WindowsTweaks_Tasks = $true}
IF($BOX_WindowsTweaks_Features.Checked) {$hash.WindowsTweaks_Features = $true}
IF($BOX_WindowsTweaks_Services.Checked) {$hash.WindowsTweaks_Services = $true}
IF($BOX_WindowsTweaks_Index.Checked) {$hash.WindowsTweaks_Index = $true}
IF($BOX_Clear_Cache.Checked) {$hash.Clear_Cache = $true}
IF($BOX_Extended_Cleanup.Checked) {$hash.Extended_Cleanup = $true}
IF($BOX_Idle_Tasks.Checked) {$hash.Idle_Tasks = $true}
$Form.Close()
}
$form = New-Object System.Windows.Forms.Form
$form.Size = New-Object Drawing.Point 710,509
$form.text = "Windows_Optimisation_Pack | $([char]0x00A9) Marvin700"
$form.StartPosition = "CenterScreen"
$form.ForeColor='#aaaaaa'
$form.BackColor=$DefaultBackColor
$form.MinimizeBox = $false
$form.MaximizeBox = $false
$form.TopMost = $true
$Image = new-object Windows.Forms.PictureBox
$img = [System.Drawing.Image]::Fromfile("$ScriptFolder\Logo.png")
$Image.Width = $img.Size.Width
$Image.Height = $img.Size.Height
$Image.Location=New-Object System.Drawing.Point(68,20)
$Image.Image = $img
$Titel_Warning = New-Object Windows.Forms.Label
$Titel_Warning.Size = New-Object Drawing.Point 200,25
$Titel_Warning.Location = New-Object Drawing.Point 50,422
$Titel_Warning.ForeColor='#e8272f'
IF($Administrator -ne $True){$Titel_Warning.text = "PowerShell is not Administrator"}
## GUI Main
$Text_Info = New-Object Windows.Forms.Label
$Text_Info.Size = New-Object Drawing.Point 150,150
$Text_Info.Location = New-Object Drawing.Point 150,215
$Text_Info.text = "
Pack Version
$Branch $Version
$WindowsVersion
Build $BuildNumber
Reboot Pending
$PendingReboot
Administrator Permission
$Administrator
"
$BUTTON_Optimise = New-Object System.Windows.Forms.Button
$BUTTON_Optimise.Text = "Debloat and Optimise"
$BUTTON_Optimise.Size = New-Object Drawing.Point 169,54
$BUTTON_Optimise.Location = New-Object Drawing.Point 370,230
$BUTTON_Optimise.add_Click{GUI_Optimise}
$BUTTON_Maintenance = New-Object System.Windows.Forms.Button
$BUTTON_Maintenance.Text = "Maintenance and Tools"
$BUTTON_Maintenance.Size = New-Object Drawing.Point 169,54
$BUTTON_Maintenance.Location = New-Object Drawing.Point 370,310
$BUTTON_Maintenance.Enabled = $true
$BUTTON_Maintenance.add_Click{GUI_Maintenance}#
$BUTTON_Exit = New-Object System.Windows.Forms.Button
$BUTTON_Exit.Size = New-Object Drawing.Point 113,36
$BUTTON_Exit.Location = New-Object Drawing.Point 270,410
$BUTTON_Exit.Text = "Exit"
$BUTTON_Exit.add_Click{$hash.Exit = $true; $Form.Close()}
## GUI Optimisation
$Titel_Essentials = New-Object Windows.Forms.Label
$Titel_Essentials.Size = New-Object Drawing.Point 135,25
$Titel_Essentials.Location = New-Object Drawing.Point 50,215
$Titel_Essentials.text = "Essentials"
$Titel_Tweaks = New-Object Windows.Forms.Label
$Titel_Tweaks.Size = New-Object Drawing.Point 135,25
$Titel_Tweaks.Location = New-Object Drawing.Point 200,215
$Titel_Tweaks.text = "Tweaks"
$Titel_Extras = New-Object Windows.Forms.Label
$Titel_Extras.Size = New-Object Drawing.Point 135,25
$Titel_Extras.Location = New-Object Drawing.Point 370,215
$Titel_Extras.text = "Cleanup"
$Titel_Presets = New-Object Windows.Forms.Label
$Titel_Presets.Size = New-Object Drawing.Point 135,25
$Titel_Presets.Location = New-Object Drawing.Point 530,215
$Titel_Presets.text = "Presets"
# Essentials
$BOX_SystemPoint = New-Object System.Windows.Forms.CheckBox
$BOX_SystemPoint.Size = New-Object Drawing.Point 135,25
$BOX_SystemPoint.Location = New-Object Drawing.Point 27,248
$BOX_SystemPoint.Text = "Restore Point"
$BOX_SystemPoint.Checked = $true
$BOX_SystemPoint.Enabled = $false
$BOX_Checks = New-Object System.Windows.Forms.CheckBox
$BOX_Checks.Size = New-Object Drawing.Point 135,25
$BOX_Checks.Location = New-Object Drawing.Point 27,279
$BOX_Checks.Text = "System Check"
$BOX_Checks.Checked = $true
$BOX_Checks.Enabled = $false
$BOX_SophiaScript = New-Object System.Windows.Forms.CheckBox
$BOX_SophiaScript.Size = New-Object Drawing.Point 135,25
$BOX_SophiaScript.Location = New-Object Drawing.Point 27,310
$BOX_SophiaScript.Text = "Sophia Script"
$BOX_ooShutup = New-Object System.Windows.Forms.CheckBox
$BOX_ooShutup.Size = New-Object Drawing.Point 135,25
$BOX_ooShutup.Location = New-Object Drawing.Point 27,341
$BOX_ooShutup.Text = "O&&O ShutUp10"
# Tweaks
$BOX_WindowsTweaks_Registry = New-Object System.Windows.Forms.CheckBox
$BOX_WindowsTweaks_Registry.Size = New-Object Drawing.Point 135,25
$BOX_WindowsTweaks_Registry.Location = New-Object Drawing.Point 180,248
$BOX_WindowsTweaks_Registry.Text = "Registry Tweaks"
$BOX_WindowsTweaks_Tasks = New-Object System.Windows.Forms.CheckBox
$BOX_WindowsTweaks_Tasks.Size = New-Object Drawing.Point 135,25
$BOX_WindowsTweaks_Tasks.Location = New-Object Drawing.Point 180,279
$BOX_WindowsTweaks_Tasks.Text = "Deaktivate Tasks"
$BOX_WindowsTweaks_Features = New-Object System.Windows.Forms.CheckBox
$BOX_WindowsTweaks_Features.Size = New-Object Drawing.Point 135,25
$BOX_WindowsTweaks_Features.Location = New-Object Drawing.Point 180,310
$BOX_WindowsTweaks_Features.Text = "Disable Features"
$BOX_WindowsTweaks_Services = New-Object System.Windows.Forms.CheckBox
$BOX_WindowsTweaks_Services.Size = New-Object Drawing.Point 135,25
$BOX_WindowsTweaks_Services.Location = New-Object Drawing.Point 180,341
$BOX_WindowsTweaks_Services.Text = "Disable Services"
$BOX_WindowsTweaks_Index = New-Object System.Windows.Forms.CheckBox
$BOX_WindowsTweaks_Index.Size = New-Object Drawing.Point 135,25
$BOX_WindowsTweaks_Index.Location = New-Object Drawing.Point 180,372
$BOX_WindowsTweaks_Index.Text = "Disable Indexing"
# Extras
$BOX_Clear_Cache = New-Object System.Windows.Forms.CheckBox
$BOX_Clear_Cache.Size = New-Object Drawing.Point 135,25
$BOX_Clear_Cache.Location = New-Object Drawing.Point 350,248
$BOX_Clear_Cache.Text = "Clear Cache"
$BOX_Extended_Cleanup = New-Object System.Windows.Forms.CheckBox
$BOX_Extended_Cleanup.Size = New-Object Drawing.Point 145,25
$BOX_Extended_Cleanup.Location = New-Object Drawing.Point 350,279
$BOX_Extended_Cleanup.Text = "Extended Cleanup"
$BOX_Idle_Tasks = New-Object System.Windows.Forms.CheckBox
$BOX_Idle_Tasks.Size = New-Object Drawing.Point 135,25
$BOX_Idle_Tasks.Location = New-Object Drawing.Point 350,310
$BOX_Idle_Tasks.Text = "Run Idle Tasks"
# Presets
$BUTTON_Preset_Minimal = New-Object System.Windows.Forms.Button
$BUTTON_Preset_Minimal.Size = New-Object Drawing.Point 110,35
$BUTTON_Preset_Minimal.Location = New-Object Drawing.Point 507,250
$BUTTON_Preset_Minimal.Text = "Minimal"
$BUTTON_Preset_Minimal.add_Click{GUI_Optimise_Minimal}
$BUTTON_Preset_Standard = New-Object System.Windows.Forms.Button
$BUTTON_Preset_Standard.Size = New-Object Drawing.Point 110,35
$BUTTON_Preset_Standard.Location = New-Object Drawing.Point 507,300
$BUTTON_Preset_Standard.Text = "Standard"
$BUTTON_Preset_Standard.add_Click{GUI_Optimise_Standard}
$BUTTON_Preset_Enhanced = New-Object System.Windows.Forms.Button
$BUTTON_Preset_Enhanced.Size = New-Object Drawing.Point 110,35
$BUTTON_Preset_Enhanced.Location = New-Object Drawing.Point 507,350
$BUTTON_Preset_Enhanced.Text = "Enhanced"
$BUTTON_Preset_Enhanced.add_Click{GUI_Optimise_Enhanced}
# Menu Button
$BUTTON_Menu = New-Object System.Windows.Forms.Button
$BUTTON_Menu.Size = New-Object Drawing.Point 75,24
$BUTTON_Menu.Location = New-Object Drawing.Point 265,422
$BUTTON_Menu.Text = "Menu"
$BUTTON_Menu.add_Click{GUI_Menu}
$BUTTON_Start = New-Object System.Windows.Forms.Button
$BUTTON_Start.Text = "Start"
$BUTTON_Start.Size = New-Object Drawing.Point 75,24
$BUTTON_Start.Location = New-Object Drawing.Point 360,422
$BUTTON_Start.add_Click($handler_button_Start_Click)
IF(!($Administrator -eq "True")){$BUTTON_Start.Enabled = $false}
# Maintance
$Titel_Placeholder = New-Object Windows.Forms.Label
$Titel_Placeholder.Size = New-Object Drawing.Point 275,75
$Titel_Placeholder.Location = New-Object Drawing.Point 200,300
$Titel_Placeholder.text = "Development :)
use the scripts in the config Folder"
function GUI_Menu
{
$form.Controls.Clear()
$form.controls.add($Image)
$form.controls.add($Text_Info)
$form.controls.add($Titel_Warning)
$form.Controls.add($BUTTON_Optimise)
$form.Controls.add($BUTTON_Maintenance)
$form.Controls.add($BUTTON_Exit)
}
function GUI_Optimise
{
$form.Controls.Clear()
$form.controls.add($Image)
$form.controls.add($Titel_Warning)
$form.controls.add($Titel_Essentials)
$form.controls.add($Titel_Tweaks)
$form.controls.add($Titel_Extras)
$form.controls.add($Titel_Presets)
$form.Controls.Add($BOX_Checks)
$form.Controls.Add($BOX_SystemPoint)
$form.Controls.Add($BOX_SophiaScript)
$form.Controls.Add($BOX_ooShutup)
$form.Controls.Add($BOX_WindowsTweaks_Registry)
$form.Controls.Add($BOX_WindowsTweaks_Tasks)
$form.Controls.Add($BOX_WindowsTweaks_Features)
$form.Controls.Add($BOX_WindowsTweaks_Services)
$form.Controls.Add($BOX_WindowsTweaks_Index)
$form.Controls.Add($BOX_Clear_Cache)
$form.Controls.Add($BOX_Extended_Cleanup)
$form.Controls.Add($BOX_Idle_Tasks)
$form.Controls.Add($BUTTON_Preset_Minimal)
$form.Controls.Add($BUTTON_Preset_Standard)
$form.Controls.Add($BUTTON_Preset_Enhanced)
$form.Controls.Add($BUTTON_Start)
$form.Controls.Add($BUTTON_Menu)
}
function GUI_Optimise_Minimal
{
$BUTTON_Preset_Minimal.BackColor = $HighlighBackColor
$BUTTON_Preset_Standard.BackColor = $DefaultBackColor
$BUTTON_Preset_Enhanced.BackColor = $DefaultBackColor
$BOX_SophiaScript.Checked = $false
$BOX_ooShutup.Checked = $true
$BOX_WindowsTweaks_Registry.Checked = $false
$BOX_WindowsTweaks_Tasks.Checked = $true
$BOX_WindowsTweaks_Features.Checked = $false
$BOX_WindowsTweaks_Services.Checked = $true
$BOX_WindowsTweaks_Index.Checked = $true
$BOX_Clear_Cache.Checked = $true
$BOX_Extended_Cleanup.Checked = $false
$BOX_Idle_Tasks.Checked = $false
$form.Refresh
}
function GUI_Optimise_Standard
{
$BUTTON_Preset_Standard.BackColor = $HighlighBackColor
$BUTTON_Preset_Minimal.BackColor = $DefaultBackColor
$BUTTON_Preset_Enhanced.BackColor = $DefaultBackColor
$BOX_SophiaScript.Checked = $true
$BOX_ooShutup.Checked = $true
$BOX_WindowsTweaks_Registry.Checked = $true
$BOX_WindowsTweaks_Tasks.Checked = $true
$BOX_WindowsTweaks_Features.Checked = $false
$BOX_WindowsTweaks_Services.Checked = $true
$BOX_WindowsTweaks_Index.Checked = $true
$BOX_Clear_Cache.Checked = $true
$BOX_Extended_Cleanup.Checked = $false
$BOX_Idle_Tasks.Checked = $true
$form.Refresh
}
function GUI_Optimise_Enhanced
{
$BUTTON_Preset_Enhanced.BackColor = $HighlighBackColor
$BUTTON_Preset_Standard.BackColor = $DefaultBackColor
$BUTTON_Preset_Minimal.BackColor = $DefaultBackColor
$BOX_SophiaScript.Checked = $true
$BOX_ooShutup.Checked = $true
$BOX_WindowsTweaks_Registry.Checked = $true
$BOX_WindowsTweaks_Tasks.Checked = $true
$BOX_WindowsTweaks_Features.Checked = $true
$BOX_WindowsTweaks_Services.Checked = $true
$BOX_WindowsTweaks_Index.Checked = $true
$BOX_Clear_Cache.Checked = $true
$BOX_Extended_Cleanup.Checked = $true
$BOX_Idle_Tasks.Checked = $true
$form.Refresh
}
function GUI_Maintenance
{
$form.Controls.Clear()
$form.controls.add($Image)
$form.controls.add($Titel_Placeholder)
$form.Controls.Add($BUTTON_Menu)
}
GUI_Menu
GUI_Optimise_Standard
$form.ShowDialog() | Out-Null
#Show Window
[User32.WinAPI]::ShowWindow($HideWindow, 9)
}
function GUI_Menu{
IF($hash.Exit){exit}
IF($hash.SystemPoint){SystemPoint}
IF($hash.Checks){Checks_and_Preperations}
IF($hash.WindowsTweaks_Services){WindowsTweaks_Services}
IF($hash.ooShutup){ooShutup}
IF($hash.SophiaScript){SophiaScript}
IF($hash.WindowsTweaks_Tasks){WindowsTweaks_Tasks}
IF($hash.WindowsTweaks_Registry){WindowsTweaks_Registry}
IF($hash.WindowsTweaks_Features){WindowsTweaks_Features}
IF($hash.WindowsTweaks_Index){WindowsTweaks_Index}
IF($hash.Clear_Cache){Clear_Cache}
IF($hash.Extended_Cleanup){Extended_Cleanup}
IF($hash.Idle_Tasks){Idle_Tasks}
IF($hash.Driver_Cleaner){Driver_Cleaner}}
GUI
GUI_Menu
Finish