mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2025-11-17 02:56:17 +00:00
Running script with -Verbose parameter now shows app uninstall progress bars
Linting
This commit is contained in:
3
Get.ps1
3
Get.ps1
@@ -1,5 +1,6 @@
|
||||
param (
|
||||
[switch]$Silent,
|
||||
[switch]$Verbose,
|
||||
[switch]$Sysprep,
|
||||
[switch]$RunAppConfigurator,
|
||||
[switch]$RunDefaults, [switch]$RunWin11Defaults,
|
||||
@@ -84,7 +85,7 @@ Write-Output "> Running Win11Debloat..."
|
||||
$debloatProcess = Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat-master\Win11Debloat.ps1 $arguments" -Verb RunAs
|
||||
|
||||
# Wait for the process to finish before continuing
|
||||
if($debloatProcess -ne $null) {
|
||||
if ($null -ne $debloatProcess) {
|
||||
$debloatProcess.WaitForExit()
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ function ForceRemoveEdge {
|
||||
|
||||
# Remove edge
|
||||
$uninstallRegKey = $hklm.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge')
|
||||
if($uninstallRegKey -ne $null) {
|
||||
if ($null -ne $uninstallRegKey) {
|
||||
Write-Output "Running uninstaller..."
|
||||
$uninstallString = $uninstallRegKey.GetValue('UninstallString') + ' --force-uninstall'
|
||||
Start-Process cmd.exe "/c $uninstallString" -WindowStyle Hidden -Wait
|
||||
@@ -513,6 +513,7 @@ function ReplaceStartMenuForAllUsers {
|
||||
# Check if template bin file exists, return early if it doesn't
|
||||
if (-not (Test-Path $startMenuTemplate)) {
|
||||
Write-Host "Error: Unable to clear start menu, start2.bin file missing from script folder" -ForegroundColor Red
|
||||
Write-Output ""
|
||||
return
|
||||
}
|
||||
|
||||
@@ -675,9 +676,6 @@ else {
|
||||
# Get current Windows build version to compare against features
|
||||
$WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild
|
||||
|
||||
# Hide progress bars for app removal, as they block Win11Debloat's output
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
$global:Params = $PSBoundParameters
|
||||
$global:FirstSelection = $true
|
||||
$SPParams = 'WhatIf', 'Confirm', 'Verbose', 'Silent', 'Sysprep'
|
||||
@@ -691,6 +689,15 @@ foreach ($Param in $SPParams) {
|
||||
}
|
||||
}
|
||||
|
||||
# Hide progress bars for app removal, as they block Win11Debloat's output
|
||||
if (-not ($global:Params.ContainsKey("Verbose"))) {
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
}
|
||||
else {
|
||||
Read-Host "Verbose mode is enabled, press enter to continue"
|
||||
$ProgressPreference = 'Continue'
|
||||
}
|
||||
|
||||
if ($global:Params.ContainsKey("Sysprep")) {
|
||||
# Exit script if default user directory or NTUSER.DAT file cannot be found
|
||||
if (-not (Test-Path "C:\Users\Default\NTUSER.DAT")) {
|
||||
|
||||
Reference in New Issue
Block a user