-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWinTool-WS-PF4Q0EQX-2.ps1
4452 lines (3842 loc) · 267 KB
/
WinTool-WS-PF4Q0EQX-2.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Import the ShowWindow function from user32.dll to manipulate the PowerShell window state.
# This allows us to hide the PowerShell console window.
#$HidePowershellWindow = '[DllImport("user32.dll")] public static extern bool ShowWindow(int handle, int state);'
# Add the ShowWindow method to the PowerShell runtime as a .NET class.
#add-type -name win -member $HidePowershellWindow -namespace native
# Retrieve the current process's main window handle and hide it (state = 0).
#[native.win]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0)
# Enable the use of Windows Forms for potential GUI elements (not used in this script, but prepares for it).
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
# Set the error handling preference to silently ignore errors.
$ErrorActionPreference = 'SilentlyContinue'
# Create an object to interact with Windows Shell for launching processes.
$wshell = New-Object -ComObject Wscript.Shell
# Check if the current user has administrator privileges.
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
# If not running as administrator, restart the script with elevated permissions.
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
# Exit the current (non-elevated) instance of the script.
Exit
}
# Global Environment folder setup here
# Retrieves commonly used folder paths using [Environment]::GetFolderPath
$pathDesktop = [Environment]::GetFolderPath("Desktop") # Path to the Desktop folder
#$pathDocuments = [Environment]::GetFolderPath("MyDocuments") # Path to the Documents folder
#$pathPictures = [Environment]::GetFolderPath("MyPictures") # Path to the Pictures folder
#$pathAppdataLocal = [Environment]::GetFolderPath("LocalApplicationData") # Path to the local AppData folder
#$pathAppdataRoaming = [Environment]::GetFolderPath("ApplicationData") # Path to the roaming AppData folder
#$pathWindows = [Environment]::GetFolderPath("Windows") # Path to the Windows folder
#$pathSystem = [Environment]::GetFolderPath("System") # Path to the System folder (e.g., System32)
####################################################################################
function EnsureWinget {
if (!(Get-Command winget -ErrorAction SilentlyContinue)) {
[System.Windows.Forms.MessageBox]::Show(
"Winget (Windows Package Manager) is not available. Please update your Windows installation to use this script.",
"Winget Not Found",
[System.Windows.Forms.MessageBoxButtons]::OK,
[System.Windows.Forms.MessageBoxIcon]::Error
)
return $false
}
return $true
}
function IsAppInstalled {
param (
[string]$AppName,
[array]$AdditionalPaths = @()
)
# Base paths to check
$basePaths = @(
"C:\Program Files\$AppName",
"C:\Program Files (x86)\$AppName",
"$([Environment]::GetFolderPath('LocalApplicationData'))\$AppName",
"$([Environment]::GetFolderPath('ApplicationData'))\$AppName"
)
# Include additional paths specific to certain applications
$allPaths = $basePaths + $AdditionalPaths
# Check each path for traditional apps
foreach ($path in $allPaths) {
if (Test-Path $path) {
return $true
}
}
# Check for UWP apps using Get-AppxPackage with stricter matching
try {
if ($AppName -ieq "Steam") {
# Steam is not a UWP app; skip Get-AppxPackage checks
Write-Host "Skipping UWP check for Steam."
return $false
}
$installedPackages = Get-AppxPackage
foreach ($package in $installedPackages) {
# Match AppName against relevant properties (case-insensitive exact match)
if ($package.Name -ieq $AppName -or $package.PackageFullName -like "*$AppName*") {
Write-Host "Matched UWP Package: $($package.Name)"
return $true
}
}
} catch {
Write-Warning "Failed to query UWP apps: $_"
}
# If no match is found
return $false
}
function ShowAppSelectionForm {
$frontcolor = [System.Drawing.ColorTranslator]::FromHtml("#182C36")
$backcolor = [System.Drawing.ColorTranslator]::FromHtml("#5095B5")
$hovercolor = [System.Drawing.ColorTranslator]::FromHtml("#346075")
# Array to store checkbox references
$checkboxes = @()
$appSelectionForm = New-Object System.Windows.Forms.Form
$appSelectionForm.Text = "Select Applications to Install"
$appSelectionForm.StartPosition = "CenterScreen"
$appSelectionForm.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$appSelectionForm.MaximizeBox = $false # Disable the maximize button
$appSelectionForm.MinimizeBox = $true # Optionally keep the minimize button enabled
# Dynamically adjust size based on screen resolution
$screenWidth = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width
$screenHeight = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height
$appSelectionForm.Size = New-Object System.Drawing.Size([math]::Min($screenWidth * 0.8, 805), [math]::Min($screenHeight * 0.8, 600))
# Create a flow layout panel for dynamic arrangement
$flowLayoutPanel = New-Object System.Windows.Forms.FlowLayoutPanel
$flowLayoutPanel.Dock = [System.Windows.Forms.DockStyle]::Fill
$flowLayoutPanel.AutoScroll = $true
$flowLayoutPanel.WrapContents = $true
$flowLayoutPanel.FlowDirection = [System.Windows.Forms.FlowDirection]::LeftToRight
$appSelectionForm.Controls.Add($flowLayoutPanel)
function CreateCategoryPanel($category) {
$panel = New-Object System.Windows.Forms.Panel
$panel.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle
$panel.Size = New-Object System.Drawing.Size(250, 300)
# Add category label
$label = New-Object System.Windows.Forms.Label
$label.Text = $category.Name
$label.Font = New-Object System.Drawing.Font("Arial", 10, [System.Drawing.FontStyle]::Bold)
$label.AutoSize = $true
$label.Location = New-Object System.Drawing.Point(5, 5)
$panel.Controls.Add($label)
# Create a sub-panel for checkboxes
$checkboxPanel = New-Object System.Windows.Forms.Panel
$checkboxPanel.AutoScroll = $true
$checkboxPanel.Size = New-Object System.Drawing.Size(240, 260)
$checkboxPanel.Location = New-Object System.Drawing.Point(5, 25)
foreach ($app in $category.Applications) {
$isInstalled = IsAppInstalled -AppName $app.AppName -AdditionalPaths $app.AdditionalPaths
$checkbox = New-Object System.Windows.Forms.CheckBox
$checkbox.Text = $app.Name
$checkbox.Enabled = -not $isInstalled
$checkbox.AutoSize = $true
$checkbox.Tag = $app # Store app details in the Tag property
$checkbox.Dock = [System.Windows.Forms.DockStyle]::Top
$checkboxPanel.Controls.Add($checkbox)
# Add checkbox to global array
$script:checkboxes += $checkbox
}
$panel.Controls.Add($checkboxPanel)
return $panel
}
$categories = @(
@{ Name = "Browsers"; Applications = @(
@{ Name = "Brave Browser"; AppName = "BraveSoftware"; WingetID = "Brave.Brave"; AdditionalPaths = @("Brave-Browser\Application") },
@{ Name = "Google Chrome"; AppName = "Google"; WingetID = "Google.Chrome"; AdditionalPaths = @("Google Chrome\Application\chrome.exe") },
@{ Name = "Mozilla Firefox"; AppName = "Mozilla Firefox"; WingetID = "Mozilla.Firefox"; AdditionalPaths = @("firefox.exe") },
@{ Name = "Microsoft Edge"; AppName = "Microsoft Edge"; WingetID = "Microsoft.Edge"; AdditionalPaths = @("Microsoft\Edge\Application\msedge.exe") },
@{ Name = "Opera"; AppName = "Opera Software"; WingetID = "Opera.Opera"; AdditionalPaths = @("Opera\launcher.exe") },
@{ Name = "Vivaldi"; AppName = "Vivaldi Technologies"; WingetID = "Vivaldi.Vivaldi"; AdditionalPaths = @("Vivaldi\Application\vivaldi.exe") },
@{ Name = "Tor Browser"; AppName = "The Tor Project"; WingetID = "TorProject.TorBrowser"; AdditionalPaths = @("Tor Browser\Browser\firefox.exe") }
)},
@{ Name = "Video Apps"; Applications = @(
@{ Name = "Netflix"; AppName = "Netflix"; WingetID = "9wzdncrfj3tj"; AdditionalPaths = @() },
@{ Name = "Disney+"; AppName = "DisneyPlus"; WingetID = "Disney.DisneyPlus"; AdditionalPaths = @() },
@{ Name = "Hulu"; AppName = "Hulu"; WingetID = "Hulu.HuluApp"; AdditionalPaths = @() },
@{ Name = "VLC Media Player"; AppName = "VideoLAN"; WingetID = "VideoLAN.VLC"; AdditionalPaths = @("VLC\vlc.exe") },
@{ Name = "Amazon Prime Video"; AppName = "Prime Video"; WingetID = "Amazon.PrimeVideo"; AdditionalPaths = @() },
@{ Name = "YouTube"; AppName = "YouTube"; WingetID = "Google.YouTube"; AdditionalPaths = @() },
@{ Name = "Plex"; AppName = "Plex"; WingetID = "Plex.PlexMediaServer"; AdditionalPaths = @() },
@{ Name = "Kodi"; AppName = "Kodi"; WingetID = "XBMCFoundation.Kodi"; AdditionalPaths = @() },
@{ Name = "Twitch"; AppName = "Twitch"; WingetID = "Twitch.Twitch"; AdditionalPaths = @() }
)},
@{ Name = "Music Apps"; Applications = @(
@{ Name = "Spotify"; AppName = "Spotify"; WingetID = "9ncbcszsjrsb"; AdditionalPaths = @("Spotify.exe") },
@{ Name = "Apple Music"; AppName = "Apple Music"; WingetID = "Apple.Music"; AdditionalPaths = @() },
@{ Name = "YouTube Music"; AppName = "YouTube Music"; WingetID = "YouTube.Music"; AdditionalPaths = @() },
@{ Name = "Amazon Music"; AppName = "Amazon Music"; WingetID = "Amazon.AmazonMusic"; AdditionalPaths = @() },
@{ Name = "Tidal"; AppName = "Tidal"; WingetID = "TIDAL.TIDAL"; AdditionalPaths = @() },
@{ Name = "Pandora"; AppName = "Pandora"; WingetID = "Pandora.Pandora"; AdditionalPaths = @() },
@{ Name = "Deezer"; AppName = "Deezer"; WingetID = "Deezer.Deezer"; AdditionalPaths = @() }
)},
@{ Name = "Social Media"; Applications = @(
@{ Name = "Instagram"; AppName = "Instagram"; WingetID = "9nblggh5l9xt"; AdditionalPaths = @() },
@{ Name = "WhatsApp Desktop"; AppName = "WhatsApp"; WingetID = "9nksqgp7f2nh"; AdditionalPaths = @() },
@{ Name = "Telegram"; AppName = "Telegram Desktop"; WingetID = "Telegram.TelegramDesktop"; AdditionalPaths = @("Telegram.exe") },
@{ Name = "Discord"; AppName = "Discord"; WingetID = "Discord.Discord"; AdditionalPaths = @("Update.exe") },
@{ Name = "Zoom"; AppName = "Zoom"; WingetID = "Zoom.Zoom"; AdditionalPaths = @("bin\Zoom.exe") },
@{ Name = "Slack"; AppName = "Slack Technologies"; WingetID = "SlackTechnologies.Slack"; AdditionalPaths = @("Slack.exe") },
@{ Name = "Facebook"; AppName = "Facebook"; WingetID = "Facebook.Facebook"; AdditionalPaths = @() },
@{ Name = "Twitter"; AppName = "Twitter"; WingetID = "Twitter.Twitter"; AdditionalPaths = @() },
@{ Name = "LinkedIn"; AppName = "LinkedIn"; WingetID = "LinkedIn.LinkedIn"; AdditionalPaths = @() },
@{ Name = "Snapchat"; AppName = "Snapchat"; WingetID = "Snapchat.Snapchat"; AdditionalPaths = @() },
@{ Name = "TikTok"; AppName = "TikTok"; WingetID = "TikTok.TikTok"; AdditionalPaths = @() }
)},
@{ Name = "Tools"; Applications = @(
@{ Name = "Visual Studio Code"; AppName = "Microsoft VS Code"; WingetID = "Microsoft.VisualStudioCode"; AdditionalPaths = @("$([Environment]::GetFolderPath('LocalApplicationData'))\Programs\Microsoft VS Code\Code.exe") },
@{ Name = "Visual Studio Community"; AppName = "Microsoft Visual Studio"; WingetID = "Microsoft.VisualStudio.2022.Community"; AdditionalPaths = @("Common7\IDE\devenv.exe") },
@{ Name = "GitHub Desktop"; AppName = "GitHubDesktop"; WingetID = "GitHub.GitHubDesktop"; AdditionalPaths = @("GitHubDesktop.exe") },
@{ Name = "Postman"; AppName = "Postman"; WingetID = "Postman.Postman"; AdditionalPaths = @() },
@{ Name = "PuTTY"; AppName = "PuTTY"; WingetID = "PuTTY.PuTTY"; AdditionalPaths = @() },
@{ Name = "Dropbox"; AppName = "Dropbox"; WingetID = "Dropbox.Dropbox"; AdditionalPaths = @() },
@{ Name = "TeamViewer"; AppName = "TeamViewer"; WingetID = "TeamViewer.TeamViewer"; AdditionalPaths = @() }
)},
@{ Name = "Utilities"; Applications = @(
@{ Name = "7-Zip"; AppName = "7-Zip"; WingetID = "7zip.7zip"; AdditionalPaths = @() },
@{ Name = "WinRAR"; AppName = "WinRAR"; WingetID = "RARLab.WinRAR"; AdditionalPaths = @("WinRAR.exe") },
@{ Name = "Malwarebytes"; AppName = "Malwarebytes"; WingetID = "Malwarebytes.Malwarebytes"; AdditionalPaths = @() },
@{ Name = "FileZilla"; AppName = "FileZilla"; WingetID = "FileZilla.Client"; AdditionalPaths = @() },
@{ Name = "Notion"; AppName = "Notion"; WingetID = "Notion.Notion"; AdditionalPaths = @() },
@{ Name = "OpenVPN"; AppName = "OpenVPN"; WingetID = "OpenVPNTechnologies.OpenVPN"; AdditionalPaths = @() },
@{ Name = "KeePass"; AppName = "KeePass"; WingetID = "DominikReichl.KeePass"; AdditionalPaths = @() },
@{ Name = "Authy"; AppName = "Authy"; WingetID = "Twilio.Authy"; AdditionalPaths = @() },
@{ Name = "qBittorrent"; AppName = "qBittorrent"; WingetID = "qBittorrent.qBittorrent"; AdditionalPaths = @() }
)},
@{ Name = "Creative Tools"; Applications = @(
@{ Name = "Audacity"; AppName = "Audacity"; WingetID = "Audacity.Audacity"; AdditionalPaths = @() },
@{ Name = "OBS Studio"; AppName = "obs-studio"; WingetID = "OBSProject.OBSStudio"; AdditionalPaths = @() },
@{ Name = "GIMP"; AppName = "GIMP"; WingetID = "GIMP.GIMP"; AdditionalPaths = @() },
@{ Name = "Blender"; AppName = "Blender"; WingetID = "BlenderFoundation.Blender"; AdditionalPaths = @() },
@{ Name = "Inkscape"; AppName = "Inkscape"; WingetID = "Inkscape.Inkscape"; AdditionalPaths = @() },
@{ Name = "Paint.NET"; AppName = "Paint.NET"; WingetID = "dotPDNLLC.paintdotnet"; AdditionalPaths = @() },
@{ Name = "Adobe Creative Cloud"; AppName = "Adobe Creative Cloud"; WingetID = "Adobe.CreativeCloud"; AdditionalPaths = @() },
@{ Name = "Canva"; AppName = "Canva"; WingetID = "Canva.Canva"; AdditionalPaths = @() },
@{ Name = "HandBrake"; AppName = "HandBrake"; WingetID = "HandBrake.HandBrake"; AdditionalPaths = @() }
)},
@{ Name = "Documents/Editing"; Applications = @(
@{ Name = "LibreOffice"; AppName = "LibreOffice"; WingetID = "TheDocumentFoundation.LibreOffice"; AdditionalPaths = @() },
@{ Name = "Foxit PDF Reader"; AppName = "Foxit Reader"; WingetID = "Foxit.FoxitReader"; AdditionalPaths = @() },
@{ Name = "Notepad++"; AppName = "Notepad++"; WingetID = "Notepad++.Notepad++"; AdditionalPaths = @() },
@{ Name = "Adobe Acrobat Reader"; AppName = "Adobe"; WingetID = "Adobe.Acrobat.Reader.64-bit"; AdditionalPaths = @("Reader\AcroRd32.exe") },
@{ Name = "WPS Office"; AppName = "WPS Office"; WingetID = "Kingsoft.WPSOffice"; AdditionalPaths = @() },
@{ Name = "OnlyOffice"; AppName = "OnlyOffice"; WingetID = "OnlyOffice.DesktopEditors"; AdditionalPaths = @() },
@{ Name = "Sublime Text"; AppName = "Sublime Text"; WingetID = "SublimeHQ.SublimeText"; AdditionalPaths = @() }
)},
@{ Name = "Gaming"; Applications = @(
@{ Name = "Steam"; AppName = "Steam"; WingetID = "Valve.Steam"; AdditionalPaths = @("Steam.exe") },
@{ Name = "Epic Games"; AppName = "Epic Games"; WingetID = "EpicGames.EpicGamesLauncher"; AdditionalPaths = @("Launcher\EpicGamesLauncher.exe") },
@{ Name = "Battle.net"; AppName = "Battle.net"; WingetID = "Blizzard.BattleNet"; AdditionalPaths = @("Battle.net.exe") },
@{ Name = "EA Play"; AppName = "EA Play"; WingetID = "ElectronicArts.EADesktop"; AdditionalPaths = @("EA Desktop\EA Desktop.exe") },
@{ Name = "Ubisoft Connect"; AppName = "Ubisoft"; WingetID = "Ubisoft.Connect"; AdditionalPaths = @("Ubisoft Game Launcher\UbisoftConnect.exe") },
@{ Name = "GOG Galaxy"; AppName = "GOG Galaxy"; WingetID = "GOG.Galaxy"; AdditionalPaths = @("GalaxyClient.exe") },
@{ Name = "Valorant"; AppName = "Valorant"; WingetID = "RiotGames.Valorant.EU"; AdditionalPaths = @("Valorant.exe") },
@{ Name = "Minecraft"; AppName = "Minecraft Launcher"; WingetID = "Mojang.MinecraftLauncher"; AdditionalPaths = @("Minecraft.exe") },
@{ Name = "DS4Windows"; AppName = "DS4Windows"; WingetID = "Ryochan7.DS4Windows"; AdditionalPaths = @() },
@{ Name = "Amazon Games"; AppName = "Amazon Games"; WingetID = "Amazon.Games"; AdditionalPaths = @() }
)}
)
# Populate categories
foreach ($category in $categories) {
$categoryPanel = CreateCategoryPanel $category
$flowLayoutPanel.Controls.Add($categoryPanel)
}
# Add buttons and progress bar
$progressBar = New-Object System.Windows.Forms.ProgressBar
$progressBar.Size = New-Object System.Drawing.Size(700, 20)
$progressBar.Dock = [System.Windows.Forms.DockStyle]::Bottom
$appSelectionForm.Controls.Add($progressBar)
$buttonPanel = New-Object System.Windows.Forms.Panel
$buttonPanel.Dock = [System.Windows.Forms.DockStyle]::Bottom
$buttonPanel.Height = 40
$okButton = New-Object System.Windows.Forms.Button
$okButton.Text = "Install Selected"
$okButton.Size = New-Object System.Drawing.Size(120, 30)
$okButton.Location = New-Object System.Drawing.Point(10, 5)
$okButton.Add_Click({
# Ensure Winget is available before proceeding
if (-not (EnsureWinget)) {
return
}
# Dynamically collect selected applications from the flow layout panel
$selectedApps = @()
foreach ($control in $flowLayoutPanel.Controls) {
if ($control -is [System.Windows.Forms.Panel]) {
foreach ($subControl in $control.Controls) {
if ($subControl -is [System.Windows.Forms.Panel]) {
foreach ($checkbox in $subControl.Controls) {
if ($checkbox -is [System.Windows.Forms.CheckBox] -and $checkbox.Checked) {
$selectedApps += $checkbox.Tag
}
}
}
}
}
}
if ($selectedApps.Count -eq 0) {
[System.Windows.Forms.MessageBox]::Show(
"No applications selected for installation.",
"No Selection",
[System.Windows.Forms.MessageBoxButtons]::OK,
[System.Windows.Forms.MessageBoxIcon]::Warning
)
return
}
# Install selected applications
InstallApplications -SelectedApps $selectedApps -ProgressBar $progressBar
})
$buttonPanel.Controls.Add($okButton)
$cancelButton = New-Object System.Windows.Forms.Button
$cancelButton.Text = "Cancel / Exit"
$cancelButton.Size = New-Object System.Drawing.Size(120, 30)
$cancelButton.Location = New-Object System.Drawing.Point(140, 5)
$cancelButton.Add_Click({
$appSelectionForm.Close()
})
$buttonPanel.Controls.Add($cancelButton)
$updateButton = New-Object System.Windows.Forms.Button
$updateButton.Text = "Update Apps"
$updateButton.Size = New-Object System.Drawing.Size(120, 30)
$updateButton.Location = New-Object System.Drawing.Point(270, 5)
$updateButton.Add_Click({
Start-Process -FilePath "winget" -ArgumentList "upgrade --all" -NoNewWindow -Wait
})
$buttonPanel.Controls.Add($updateButton)
$appSelectionForm.Controls.Add($buttonPanel)
[void]$appSelectionForm.ShowDialog()
}
function OneDriveInstalled {
param (
[switch]$VerboseOutput
)
$oneDrivePackages = winget list | Where-Object { $_ -match "OneDrive" }
if ($oneDrivePackages) {
if ($VerboseOutput) {
Write-Output "Detected the following OneDrive packages:"
$oneDrivePackages | ForEach-Object { Write-Output $_ }
}
return $oneDrivePackages
} else {
return $null
}
}
function Uninstall-OneDrive {
$ResultText.text = "Starting removal of OneDrive-related packages..."
# Step 1: Remove AppxPackages for all users
$ResultText.text = "Removing OneDrive AppxPackages for all users..."
$appxPackages = Get-AppxPackage -AllUsers | Where-Object { $_.Name -like "*OneDrive*" }
if ($appxPackages) {
foreach ($package in $appxPackages) {
$ResultText.text = "Removing AppxPackage: $($package.Name)..."
Remove-AppxPackage -Package $package.PackageFullName -AllUsers -ErrorAction SilentlyContinue
}
} else {
$ResultText.text = "No OneDrive AppxPackages found for removal."
}
# Step 2: Remove Provisioned AppxPackages
$ResultText.text = "Removing provisioned OneDrive packages..."
$provisionedPackages = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -like "*OneDrive*" }
if ($provisionedPackages) {
foreach ($package in $provisionedPackages) {
$ResultText.text = "Removing Provisioned AppxPackage: $($package.DisplayName)..."
Remove-AppxProvisionedPackage -Online -PackageName $package.PackageName -ErrorAction SilentlyContinue
}
} else {
$ResultText.text = "No provisioned OneDrive packages found for removal."
}
# Step 3: Remove OneDrive packages via winget
$ResultText.text = "Detecting all installed OneDrive packages using winget..."
# Attempt to uninstall it again
$ResultText.text = "Confirming winget has uninstalled the package..."
Start-Process -FilePath "winget" -ArgumentList "uninstall --id Microsoft.OneDrive" -NoNewWindow -Wait
# Final confirmation
$ResultText.text = "All detected OneDrive-related packages have been removed."
}
$oneDrivePackages = OneDriveInstalled -VerboseOutput
function InstallApplications {
param (
[array]$SelectedApps,
[System.Windows.Forms.ProgressBar]$ProgressBar
)
if (-not (EnsureWinget)) {
return
}
$totalApps = $SelectedApps.Count
$ProgressBar.Maximum = $totalApps
foreach ($app in $SelectedApps) {
try {
# Check if the app is already installed as a UWP app
$isInstalled = Get-AppxPackage | Where-Object { $_.Name -eq $app.AppName }
if ($isInstalled) {
Write-Host "$($app.Name) is already installed."
continue
}
# Install the app using Microsoft Store if a StoreID is provided
if ($app.StoreID) {
try {
Write-Host "Attempting to install $($app.Name) using Microsoft Store."
Start-Process -FilePath "ms-windows-store:" -ArgumentList "pdp?productid=$($app.StoreID)" -NoNewWindow -Wait
continue
} catch {
Write-Warning "Failed to install $($app.Name) using Microsoft Store: $_"
}
}
# Fallback to Winget installation if a WingetID is provided
if ($app.WingetID) {
Write-Host "Attempting to install $($app.Name) using Winget."
Start-Process -FilePath "winget" -ArgumentList "install --id $($app.WingetID) --silent --accept-source-agreements --accept-package-agreements" -NoNewWindow -Wait
continue
}
# Notify the user if the app cannot be installed automatically
[System.Windows.Forms.MessageBox]::Show(
"$($app.Name) cannot be installed automatically. Please install it manually.",
"Manual Installation Required",
[System.Windows.Forms.MessageBoxButtons]::OK,
[System.Windows.Forms.MessageBoxIcon]::Information
)
# Update progress bar
$ProgressBar.Invoke([Action]{
$ProgressBar.PerformStep()
})
} catch {
[System.Windows.Forms.MessageBox]::Show(
"Error installing $($app.Name): $_",
"Error",
[System.Windows.Forms.MessageBoxButtons]::OK,
[System.Windows.Forms.MessageBoxIcon]::Error
)
}
}
# Reset progress bar after completion
$ProgressBar.Invoke([Action]{
$ProgressBar.Value = 0
})
}
# Function to Add Panels
Function Add-Panel {
param (
[int]$Width,
[int]$Height,
[System.Drawing.Point]$Location
)
$panel = New-Object system.Windows.Forms.Panel
$panel.Width = $Width
$panel.Height = $Height
$panel.Location = $Location
#$panel.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")
return $panel
}
function Add-Control {
param (
[string]$Text,
[int]$X,
[int]$Y,
[int]$Width = 220,
[int]$Height = 30,
[string]$Font = 'Microsoft Sans Serif',
[int]$FontSize = 12,
[System.Drawing.Color]$BackColor = [System.Drawing.ColorTranslator]::FromHtml("#182C36"),
[System.Drawing.Color]$ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#5095B5"),
[System.Drawing.Color]$HoverColor = [System.Drawing.ColorTranslator]::FromHtml("#346075"),
[string]$ControlType = "Button" # Default to Button, can be "Label", "ComboBox", or "CheckBox"
)
switch ($ControlType) {
"Button" {
$control = New-Object system.Windows.Forms.Button -Property @{
Text = $Text
Width = $Width
Height = $Height
Location = New-Object System.Drawing.Point($X, $Y)
Font = New-Object System.Drawing.Font($Font, $FontSize)
BackColor = $BackColor
ForeColor = $ForeColor
FlatStyle = "Flat"
}
$control.FlatAppearance.MouseOverBackColor = $HoverColor
}
"Label" {
$control = New-Object system.Windows.Forms.Label -Property @{
Text = $Text
Width = $Width
Height = $Height
Location = New-Object System.Drawing.Point($X, $Y)
Font = New-Object System.Drawing.Font($Font, $FontSize, [System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
ForeColor = $BackColor
TextAlign = "MiddleCenter"
BackColor = $ForeColor # Optional: Makes the label's background visible
AutoSize = $false
}
}
"ComboBox" {
$control = New-Object system.Windows.Forms.ComboBox -Property @{
Width = $Width
Height = $Height
Location = New-Object System.Drawing.Point($X, $Y)
Font = New-Object System.Drawing.Font($Font, $FontSize)
FlatStyle = "Flat" # Match button style
BackColor = $BackColor
ForeColor = $ForeColor
}
$control.DropDownStyle = "DropDownList"
$control.Refresh()
}
"CheckBox" {
$control = New-Object system.Windows.Forms.CheckBox -Property @{
Text = $Text
Width = $Width
Height = $Height
Location = New-Object System.Drawing.Point($X, $Y)
Font = New-Object System.Drawing.Font($Font, $FontSize)
BackColor = $ForeColor
ForeColor = $BackColor
AutoSize = $false
}
}
default {
throw "Unsupported control type: $ControlType"
}
}
return $control
}
function Initialize-Cleaning {
param (
[string]$Target, # Path to the folder or special target
[string[]]$FileTypes = @("*.*"), # File types to clean, default is all
[string]$Description = "files", # Description for user prompts
[switch]$IsRecycleBin = $false, # Special handling for Recycle Bin
[switch]$IsWindowsUpdate = $false # Special handling for Windows Update folder
)
# Define target path for special cases
if ($IsRecycleBin) {
$Target = "C:\`$Recycle.Bin"
}
# Check if target exists
if (Test-Path $Target) {
# Calculate size
$size = if ($IsRecycleBin -or $IsWindowsUpdate) {
(Get-ChildItem -Path $Target -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1GB
} else {
(Get-ChildItem -Path $Target -Recurse -Include $FileTypes -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1GB
}
# Display size and prompt user
if ($size -gt 0.1) {
$prompt = [System.Windows.Forms.MessageBox]::Show(
"The $Description in $Target contains {0:N2} GB. Do you want to clean it?" -f $size,
"Confirm Cleaning",
[System.Windows.Forms.MessageBoxButtons]::YesNo
)
if ($prompt -eq [System.Windows.Forms.DialogResult]::Yes) {
if ($IsRecycleBin) {
# Special handling for Recycle Bin
Write-Host "Starting cleanup of Recycle Bin..."
$binFolders = Get-ChildItem -Path $Target -Directory -Force
foreach ($folder in $binFolders) {
try {
$sid = New-Object System.Security.Principal.SecurityIdentifier($folder.Name)
$user = $sid.Translate([System.Security.Principal.NTAccount])
Write-Host "Cleaning $user's Recycle Bin..."
$ResultText.text = "Cleaning $user's Recycle Bin..."
} catch {
$user = $folder.Name
Write-Host "Cleaning Recycle Bin for SID: $user..."
$ResultText.text = "Cleaning Recycle Bin for SID: $user..."
}
# Delete files with progress
$files = Get-ChildItem -Path $folder.FullName -Recurse -Force -ErrorAction SilentlyContinue
$totalFiles = $files.Count
for ($i = 0; $i -lt $totalFiles; $i++) {
$file = $files[$i]
Write-Progress -Activity "Recycle Bin Cleanup" -Status "Deleting file [$($i + 1)/$totalFiles]: $($file.Name)" -PercentComplete ((($i + 1) / $totalFiles) * 100)
Remove-Item -Path $file.FullName -Recurse -Force
}
}
} elseif ($IsWindowsUpdate) {
# Special handling for Windows Update folder
Write-Host "Cleaning Windows Update folder..."
$ResultText.text = "Cleaning Windows Update folder..."
try {
Stop-Service -Name wuauserv -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$Target\*" -Recurse -Force -ErrorAction SilentlyContinue -Verbose
Start-Service -Name wuauserv -ErrorAction SilentlyContinue
} catch {
Write-Warning "Failed to clean Windows Update folder: $_"
$ResultText.text = "Failed to clean Windows Update folder."
}
} else {
# General folder/file cleaning
Write-Host "Cleaning $Description in $Target..."
$ResultText.text = "Cleaning $Description in $Target..."
Get-ChildItem -Path $Target -Recurse -Include $FileTypes -ErrorAction SilentlyContinue | ForEach-Object {
Remove-Item -Path $_.FullName -Recurse -Force -Verbose
}
}
Write-Progress -Activity "Cleaning $Description" -Status "Complete" -Completed
$ResultText.text = "Cleaned $Description in $Target. Freed {0:N2} GB." -f $size
Write-Host "Cleaned $Target. Freed {0:N2} GB." -f $size
} else {
Write-Host "User canceled cleaning of $Target."
$ResultText.text = "Cleaning of $Description in $Target was canceled."
}
} else {
Write-Host "The $Description in $Target is negligible ({0:N2} GB). Skipping cleanup." -f $size
$ResultText.text = "The $Description in $Target is negligible ({0:N2} GB). Skipping cleanup." -f $size
}
} else {
Write-Host "Target $Target does not exist. Skipping..."
$ResultText.text = "Target $Target does not exist. Skipping..."
}
}
Function MakeForm {
$frontcolor = [System.Drawing.ColorTranslator]::FromHtml("#182C36")
$backcolor = [System.Drawing.ColorTranslator]::FromHtml("#5095B5")
$hovercolor = [System.Drawing.ColorTranslator]::FromHtml("#346075")
#Form Design
$Form = New-Object system.Windows.Forms.Form
$Form.text = "WinTool by Alerion"
$Form.StartPosition = "CenterScreen"
$Form.TopMost = $false
$Form.BackColor = $backcolor
$Form.ForeColor = $frontcolor
$Form.AutoScaleDimensions = '192, 192'
$Form.AutoScaleMode = "Dpi"
$Form.AutoSize = $True
$Form.AutoScroll = $True
$Form.FormBorderStyle = 0
# Add Form-Level Buttons
$xButton = New-Object system.Windows.Forms.Button
$xButton.Text = "X"
$xButton.Width = 25
$xButton.Height = 25
$xButton.Location = New-Object System.Drawing.Point(1125, 10)
$xButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10)
$xButton.BackColor = $frontcolor
$xButton.ForeColor = $backcolor
$xButton.FlatStyle = "Flat"
$xButton.FlatAppearance.MouseOverBackColor = $hovercolor
# GUI Icon
$iconBase64 = [Convert]::ToBase64String((Get-Content "C:\Windows\heart.ico" -Encoding Byte))
$iconBytes = [Convert]::FromBase64String($iconBase64)
$stream = New-Object IO.MemoryStream($iconBytes, 0, $iconBytes.Length)
$stream.Write($iconBytes, 0, $iconBytes.Length)
$Form.Icon = [System.Drawing.Icon]::FromHandle((New-Object System.Drawing.Bitmap -Argument $stream).GetHIcon())
$Form.Width = $objImage.Width
$Form.Height = $objImage.Height
$Form.MinimizeBox = $false;
$Form.MaximizeBox = $false;
$supportWintool = New-Object system.Windows.Forms.Button
$supportWintool.text = "Support WinTool!"
$supportWintool.width = 200
$supportWintool.height = 25
$supportWintool.location = New-Object System.Drawing.Point(925, 10)
$supportWintool.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10)
$supportWintool.BackColor = $frontcolor
$supportWintool.ForeColor = $backcolor
$supportWintool.FlatStyle = "Flat"
$supportWintool.BorderStyle = 0
$supportWintool.FlatAppearance.MouseOverBackColor = $hovercolor
$supportWintool.TabStop = $false
$createShortcutGit = New-Object system.Windows.Forms.Button
$createShortcutGit.text = "Create Github Shortcut"
$createShortcutGit.width = 200
$createShortcutGit.height = 25
$createShortcutGit.location = New-Object System.Drawing.Point(725, 10)
$createShortcutGit.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10)
$createShortcutGit.BackColor = $frontcolor
$createShortcutGit.ForeColor = $backcolor
$createShortcutGit.FlatStyle = "Flat"
$createShortcutGit.BorderStyle = 0
$createShortcutGit.FlatAppearance.MouseOverBackColor = $hovercolor
$createShortcutGit.TabStop = $false
$CreateShortcutTool = New-Object system.Windows.Forms.Button
$CreateShortcutTool.text = "Create Desktop Shortcut"
$CreateShortcutTool.width = 200
$CreateShortcutTool.height = 25
$CreateShortcutTool.location = New-Object System.Drawing.Point(525, 10)
$CreateShortcutTool.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10)
$CreateShortcutTool.BackColor = $frontcolor
$CreateShortcutTool.ForeColor = $backcolor
$CreateShortcutTool.FlatStyle = "Flat"
$CreateShortcutTool.BorderStyle = 0
$CreateShortcutTool.FlatAppearance.MouseOverBackColor = $hovercolor
$CreateShortcutTool.TabStop = $false
$wintoollogo = New-Object System.Windows.Forms.Label
$wintoollogo.text = "WinTool by Alerion"
$wintoollogo.width = 600
$wintoollogo.height = 75
$wintoollogo.location = New-Object System.Drawing.Point(20, 20)
$wintoollogo.Font = New-Object System.Drawing.Font('Impact', 40)
$wintoollogo.ForeColor = $frontcolor
# Panels Definition
# Uniform Height and Width for Panels
$defaultPanelWidth = 220
$defaultPanelHeight = 435
$Panel1 = Add-Panel -Width $defaultPanelWidth -Height $defaultPanelHeight -Location (New-Object System.Drawing.Point(10, 100))
$Panel2 = Add-Panel -Width $defaultPanelWidth -Height $defaultPanelHeight -Location (New-Object System.Drawing.Point(240, 100))
$Panel3 = Add-Panel -Width $defaultPanelWidth -Height $defaultPanelHeight -Location (New-Object System.Drawing.Point(470, 100))
$Panel4 = Add-Panel -Width $defaultPanelWidth -Height $defaultPanelHeight -Location (New-Object System.Drawing.Point(700, 100))
$Panel5 = Add-Panel -Width $defaultPanelWidth -Height $defaultPanelHeight -Location (New-Object System.Drawing.Point(930, 100))
$Panel6 = Add-Panel -Width 1145 -Height 200 -Location (New-Object System.Drawing.Point(10, 535))
# Add Panels to Form
$Form.Controls.AddRange(@($xButton, $createShortcutGit, $CreateShortcutTool, $wintoollogo, $supportWintool, $Panel1, $Panel2, $Panel3, $Panel4, $Panel5, $Panel6))
# Main Panel that creates a perfect border hack of 2px
$ResultTextWrapper = New-Object system.Windows.Forms.TextBox
$ResultTextWrapper.Multiline = $true
$ResultTextWrapper.ReadOnly = $true
$ResultTextWrapper.Width = 1140
$ResultTextWrapper.Height = 195
$ResultTextWrapper.BackColor = $frontcolor
$ResultTextWrapper.ForeColor = $backcolor
$ResultTextWrapper.BorderStyle = 0
$Panel6.Controls.Add($ResultTextWrapper)
# This acts as a wrapper so we can set a padding without messing up the border in the next box
$ResultTextFinal = New-Object system.Windows.Forms.TextBox
$ResultTextFinal.Multiline = $true
$ResultTextFinal.ReadOnly = $true
$ResultTextFinal.AutoSize = $true
$ResultTextFinal.Width = 1136 # Adjust for border size 4px diffrence idk why
$ResultTextFinal.Height = 191 # Adjust for border size 4px diffrence idk why
$ResultTextFinal.Location = New-Object System.Drawing.Point(2, 2) # border size
$ResultTextFinal.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10)
$ResultTextFinal.BorderStyle = 0
$ResultTextFinal.BackColor = $backcolor
$ResultTextFinal.ForeColor = $frontcolor
$ResultTextWrapper.Controls.Add($ResultTextFinal)
# This is where the actual text output is produced!
$ResultText = New-Object system.Windows.Forms.TextBox
$ResultText.Multiline = $true
$ResultText.ReadOnly = $true
$ResultText.AutoSize = $true
$ResultText.Width = 1136 # Adjust for padding
$ResultText.Height = 191 # Adjust for padding
$ResultText.Location = New-Object System.Drawing.Point(10, 10) # Adjust padding here
$ResultText.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10)
$ResultText.BorderStyle = 0
$ResultText.BackColor = $backcolor
$ResultText.ForeColor = $frontcolor
$ResultTextFinal.Controls.Add($ResultText)
# Default start positions, they have to be reset for each new panel or it will be buggy..
$YPosition = 0
$XPosition = 0
#spacings
$largespacing = 70
$normalspacing = 35
$labelspacing = 40
$labelspacing2 = 35
#buttons
$largebuttonsize = 65
#$defaultbuttonsize = 30
#labels
$labelfontsize = 10
$labelheight = 35
$firstlabelstartpos = 5
#checkboxes
#$checkboxspacing = 25
#$checkboxheight = 26
#$checkboxfontsize = 10
#####################
## Panel 1 begins! ##
#####################
$performancetweaks = Add-Control -Text "Performance Tweaks" -X $XPosition -Y $firstlabelstartpos -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing
$essentialtweaks = Add-Control -Text "Essential Tweaks" -X $XPosition -Y $YPosition -Height $largebuttonsize
$YPosition += $largespacing
$essentialundo = Add-Control -Text "Undo Essential Tweaks" -X $XPosition -Y $YPosition -Height $largebuttonsize
$YPosition += $largespacing
$gamingtweaks = Add-Control -Text "Gaming Tweaks" -X $XPosition -Y $YPosition -Height $largebuttonsize
$YPosition += $largespacing
$securitypatches = Add-Control -Text "Patch Security (Caution!)" -X $XPosition -Y $YPosition -Height $largebuttonsize
$YPosition += $largespacing
if ($oneDrivePackages) {
$onedrive = Add-Control -Text "Remove OneDrive" -X $XPosition -Y $YPosition
} else {
$onedrive = Add-Control -Text "Restore OneDrive" -X $XPosition -Y $YPosition
}
$YPosition += $normalspacing
if (Test-Path "$env:programdata\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk") {
$killedge = Add-Control -Text "Remove Microsoft Edge" -X $XPosition -Y $YPosition
} else {
$killedge = Add-Control -Text "Restore Microsoft Edge" -X $XPosition -Y $YPosition
}
$YPosition += $normalspacing
if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}") {
$removehomegallery = Add-Control -Text "Remove Home and Gallery" -X $XPosition -Y $YPosition
} else {
$removehomegallery = Add-Control -Text "Restore Home and Gallery" -X $XPosition -Y $YPosition
}
#####################
## Panel 2 begins! ##
#####################
#Reset position for next Panel
$YPosition = 0
$XPosition = 0
$fixes = Add-Control -Text "Fixes" -X $XPosition -Y $firstlabelstartpos -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing
$errorscanner = Add-Control -Text "Error Scanner" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$changedns = Add-Control -Text "" -X $XPosition -Y $YPosition -ControlType "ComboBox"
@(
' Change DNS Here',
' Google DNS',
' Cloudflare DNS',
' Level3 DNS',
' OpenDNS',
' Restore Default DNS'
) | ForEach-Object { [void] $changedns.Items.Add($_) }
$changedns.SelectedIndex = 0
$YPosition += $normalspacing
$resetnetwork = Add-Control -Text "Reset Network" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$forcenorkeyboard = Add-Control -Text "Force NO/NB Language" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$dualboottime = Add-Control -Text "Set Time to UTC" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$oldmenu = Add-Control -Text "Old Menus" -X $XPosition -Y $YPosition -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing2
$ncpa = Add-Control -Text "Network Panel" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$oldcontrolpanel = Add-Control -Text "Control Panel" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$oldsoundpanel = Add-Control -Text "Sound Panel" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$oldsystempanel = Add-Control -Text "System Panel" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$oldpower = Add-Control -Text "Power Panel" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
#####################
## Panel 3 begins! ##
#####################
# Reset position for Panel 3
$YPosition = 0
$XPosition = 0
# Add controls with consistent spacing
$windowsupdate = Add-Control -Text "Windows Update" -X $XPosition -Y $firstlabelstartpos -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing
$defaultwindowsupdate = Add-Control -Text "Default Settings" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$securitywindowsupdate = Add-Control -Text "Security Updates Only" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$windowsupdatefix = Add-Control -Text "Windows Update Reset" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$microsoftstore = Add-Control -Text "Microsoft Store" -X $XPosition -Y $YPosition -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing2
$removebloat = Add-Control -Text "Remove MS Store Apps" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$reinstallbloat = Add-Control -Text "Reinstall MS Store Apps" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$cleaning = Add-Control -Text "Cleaning" -X $XPosition -Y $YPosition -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing2
$ultimateclean = Add-Control -Text "Ultimate Cleaning" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$visualtweaks = Add-Control -Text "Visual Tweaks" -X $XPosition -Y $YPosition -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing2
$darkmode = Add-Control -Text "Dark Mode" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$lightmode = Add-Control -Text "Light Mode" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
#####################
## Panel 4 begins! ##
#####################
# Reset position for Panel 4
$YPosition = 0
$XPosition = 0
# Add Label Header
$placedholderlabel = Add-Control -Text "Placeholder Label" -X $XPosition -Y $firstlabelstartpos -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing
# Add CheckBoxes for Apps
$placeholderbutton1 = Add-Control -Text "Placeholder" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$placeholderbutton2 = Add-Control -Text "Placeholder" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$placeholderbutton3 = Add-Control -Text "Placeholder" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$placeholderbutton4 = Add-Control -Text "Placeholder" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$placeholderbutton5 = Add-Control -Text "Placeholder" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$placeholderbutton6 = Add-Control -Text "Placeholder" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$placeholderbutton7 = Add-Control -Text "Placeholder" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$hibernationmenu = Add-Control -Text "Hibernation Tweaks" -X $XPosition -Y $YPosition -Height $labelheight -FontSize $labelfontsize -ControlType "Label"
$YPosition += $labelspacing2
$remhibernation = Add-Control -Text "Disable (No Fast Boot)" -X $XPosition -Y $YPosition
$YPosition += $normalspacing
$remhibernationbutfastboot = Add-Control -Text "Reduce (Fast Boot Intact)" -X $XPosition -Y $YPosition