Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit a7c1b0a

Browse files
authored
Quick run Install/Uninstall issue (#11)
* removeapplist download for quick run * installapps download for quickrun * fixes #10
1 parent dc3c2d2 commit a7c1b0a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

debloat.ps1

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
77
Exit
88
}
99

10-
$logsFolder = "$ENV:LOCALAPPDATA\debloat-logs\"
10+
$logsFolder = "$ENV:LOCALAPPDATA\debloat-logs\"
1111
$logMessage = "The log folder doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
1212
If (Test-Path $logsFolder) {
1313
Write-Output "$logsFolder exists. Skipping."
@@ -752,7 +752,12 @@ function LightMode {
752752

753753
Function RemoveApps {
754754

755-
$RemoveAppList=(Get-Content -Path .\RemoveAppsList.json | ConvertFrom-Json).RemoveAppList
755+
if (Test-Path -Path .\RemoveAppsList.json -PathType Leaf) {
756+
$RemoveAppList = (Get-Content -Path .\RemoveAppsList.json | ConvertFrom-Json).RemoveAppList
757+
} else {
758+
Invoke-WebRequest -Uri https://puvvadi.me/RemoveAppsList -OutFile $logsFolder\RemoveAppsList.json
759+
$RemoveAppList = (Get-Content -Path $logsFolder\RemoveAppsList.json | ConvertFrom-Json).RemoveAppList
760+
}
756761

757762
foreach ($RemoveApp in $RemoveAppList) {
758763
Write-Host -NoNewline "Trying to remove $($RemoveApp.Id)"
@@ -866,7 +871,13 @@ function InstallApps {
866871
}
867872
winget -v
868873
if ($?) {
869-
$AppList=(Get-Content -Path .\installapps.json | ConvertFrom-Json).Packages
874+
875+
if (Test-Path -Path .\installapps.json -PathType Leaf) {
876+
$AppList=(Get-Content -Path .\installapps.json | ConvertFrom-Json).Packages
877+
} else {
878+
Invoke-WebRequest -Uri https://puvvadi.me/installapps -OutFile $logsFolder\installapps.json
879+
$AppList=(Get-Content -Path $logsFolder\installapps.json | ConvertFrom-Json).Packages
880+
}
870881
foreach($app in $AppList) {
871882
$AppPrompt = [Windows.MessageBox]::Show("Install $($app.Name) with Scope $($app.Scope)", $($app.Name), $Button, $Warn)
872883
Switch ($AppPrompt) {

0 commit comments

Comments
 (0)