From 4ad3d84286f75ddd1a57b0d6b8f88f3c6d50b5eb Mon Sep 17 00:00:00 2001 From: Raphire <9938813+Raphire@users.noreply.github.com> Date: Tue, 17 Sep 2024 15:06:18 +0200 Subject: [PATCH] Added warning before removing Microsoft Store --- Win11Debloat.ps1 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Win11Debloat.ps1 b/Win11Debloat.ps1 index b0c6da9..0d8107a 100644 --- a/Win11Debloat.ps1 +++ b/Win11Debloat.ps1 @@ -75,6 +75,14 @@ function ShowAppSelectionForm { # saveButton eventHandler $handler_saveButton_Click= { + if ($selectionBox.CheckedItems -contains "Microsoft.WindowsStore" -and -not $Silent) { + $warningSelection = [System.Windows.Forms.Messagebox]::Show('Are you sure you wish to uninstall the Microsoft Store? This app cannot easily be reinstalled.', 'Are you sure?', 'YesNo', 'Warning') + + if ($warningSelection -eq 'No') { + return + } + } + $global:SelectedApps = $selectionBox.CheckedItems # Create file that stores selected apps if it doesn't exist @@ -84,6 +92,7 @@ function ShowAppSelectionForm { Set-Content -Path "$PSScriptRoot/CustomAppsList" -Value $global:SelectedApps + $form.DialogResult = [System.Windows.Forms.DialogResult]::OK $form.Close() } @@ -157,7 +166,7 @@ function ShowAppSelectionForm { if (-not $jobDone) { # Show error that the script was unable to get list of apps from winget - [System.Windows.MessageBox]::Show('Unable to load list of installed apps via winget, some apps may not be displayed in the list.','Error','Ok','Error') + [System.Windows.MessageBox]::Show('Unable to load list of installed apps via winget, some apps may not be displayed in the list.', 'Error', 'Ok', 'Error') } else { # Add output of job (list of apps) to $listOfApps @@ -219,7 +228,6 @@ function ShowAppSelectionForm { $button1.TabIndex = 4 $button1.Name = "saveButton" - $button1.DialogResult = [System.Windows.Forms.DialogResult]::OK $button1.UseVisualStyleBackColor = $True $button1.Text = "Confirm" $button1.Location = New-Object System.Drawing.Point(27,472)