Improved console output of Get.ps1 to better reflect what the script is doing

This commit is contained in:
Raphire
2024-05-20 14:13:14 +02:00
parent 7e899918a8
commit fda3266283

15
Get.ps1
View File

@@ -35,9 +35,15 @@ param (
[switch]$DisableShare, [switch]$HideShare
)
Clear-Host
Write-Output "-------------------------------------------------------------------------------------------"
Write-Output " Win11Debloat Script - Get"
Write-Output "-------------------------------------------------------------------------------------------"
# Make sure winget is installed and is at least v1.4
if ((Get-AppxPackage -Name "*Microsoft.DesktopAppInstaller*") -and ((winget -v) -replace 'v','' -gt 1.4)) {
# Install git if it isn't already installed
Write-Output "> Installing git..."
winget install git.git --accept-package-agreements --accept-source-agreements --disable-interactivity --no-upgrade
# Navigate to user temp directory
@@ -46,17 +52,26 @@ if ((Get-AppxPackage -Name "*Microsoft.DesktopAppInstaller*") -and ((winget -v)
# Add default install location of git to path
$env:Path += ';C:\Program Files\Git\cmd'
Write-Output ""
# Download Win11Debloat from github
Write-Output "> Downloading Win11Debloat..."
git clone https://github.com/Raphire/Win11Debloat/
# Make list of arguments
$args = $($PSBoundParameters.GetEnumerator() | ForEach-Object {"-$($_.Key)"})
Write-Output ""
# Start & run script with the provided arguments
Write-Output "> Running Win11Debloat..."
$debloatProcess = Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -File .\Win11Debloat\Win11Debloat.ps1 $args"
$debloatProcess.WaitForExit()
Write-Output ""
# Cleanup, remove Win11Debloat directory
Write-Output "> Cleaning up..."
Remove-Item -LiteralPath "Win11Debloat" -Force -Recurse
}
else {