Skip to content

Commit

Permalink
Fix Winget Install on New System
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Oct 19, 2023
1 parent 4dd00a0 commit 38ace30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
11 changes: 4 additions & 7 deletions functions/private/Install-WinUtilChoco.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ function Install-WinUtilChoco {
return
}

Write-Host "Seems Chocolatey is not installed, installing now?"
# Let user decide if they want to install Chocolatey
$confirmation = Read-Host "Are you Sure You Want To Proceed:(y/n)"
if ($confirmation -eq 'y') {
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
powershell choco feature enable -n allowGlobalConfirmation
}
Write-Host "Seems Chocolatey is not installed, installing now"
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
powershell choco feature enable -n allowGlobalConfirmation

}
Catch {
Write-Host "==========================================="
Expand Down
2 changes: 1 addition & 1 deletion functions/private/Install-WinUtilWinget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Install-WinUtilWinget {
}

Write-Host "Running Alternative Installer and Direct Installing"
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "irm https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winget.ps1 | iex"
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget"

Write-Host "Winget Installed"
}
Expand Down
13 changes: 5 additions & 8 deletions winutil.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,10 @@ function Install-WinUtilChoco {
return
}

Write-Host "Seems Chocolatey is not installed, installing now?"
# Let user decide if they want to install Chocolatey
$confirmation = Read-Host "Are you Sure You Want To Proceed:(y/n)"
if ($confirmation -eq 'y') {
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
powershell choco feature enable -n allowGlobalConfirmation
}
Write-Host "Seems Chocolatey is not installed, installing now"
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
powershell choco feature enable -n allowGlobalConfirmation

}
Catch {
Write-Host "==========================================="
Expand Down Expand Up @@ -345,7 +342,7 @@ function Install-WinUtilWinget {
}

Write-Host "Running Alternative Installer and Direct Installing"
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "irm https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winget.ps1 | iex"
Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "choco install winget"

Write-Host "Winget Installed"
}
Expand Down

0 comments on commit 38ace30

Please sign in to comment.