Skip to content

Commit

Permalink
Slimmed Down Winget Check
Browse files Browse the repository at this point in the history
- Slimmed winget check
- Edited wording of comments
  • Loading branch information
mrhaydendp authored Aug 31, 2021
1 parent 106568c commit 9c0cc78
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions win10debloat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,17 @@ If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
# GUI Specs
Write-Host "Checking winget..."

Try{
# Check if winget is already installed
$er = (invoke-expression "winget -v") 2>&1
if ($lastexitcode) {throw $er}
Write-Host "winget is already installed."
}
Catch{
# winget is not installed. Install it from the Microsoft Store
Write-Host "winget is not found, installing it right now."

# Check if winget is installed
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe){
'Winget Already Installed'
}
else{
# Installing winget from the Microsoft Store
Write-Host "Winget not found, installing it now."
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
$nid = (Get-Process AppInstaller).id
$nid = (Get-Process AppInstaller).Id
Wait-Process -Id $nid

}
Finally {
# Start installing the packages with winget
#Get-Content .\winget.txt | ForEach-Object {
# iex ("winget install -e " + $_)
#}
Write-Host Winget Installed
}

$Form = New-Object system.Windows.Forms.Form
Expand Down

0 comments on commit 9c0cc78

Please sign in to comment.