mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-29 01:11:30 -06:00
Compare commits
3 Commits
7dbb3d54e4
...
dd570c38b2
Author | SHA1 | Date | |
---|---|---|---|
|
dd570c38b2 | ||
|
2ce4f54b80 | ||
|
623e6013bf |
@ -52,7 +52,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win
|
|||||||
|
|
||||||
These are the sponsors that help keep this project alive with monthly contributions.
|
These are the sponsors that help keep this project alive with monthly contributions.
|
||||||
|
|
||||||
<!-- sponsors --><a href="https://github.com/TriHydera"><img src="https://avatars.githubusercontent.com/u/39857764?u=5dbda638f45530582eee1703b4473f2a5e229e28&v=4" width="60px" alt="User avatar: TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://avatars.githubusercontent.com/u/3272468?u=4391ed4655e4fd8b56e23b4169e44e2ac9b6cd97&v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/DelDongo"><img src="https://avatars.githubusercontent.com/u/127976398?v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/markamos"><img src="https://avatars.githubusercontent.com/u/9561861?u=3cca179dcff0413538591e57a3abea116d65ce56&v=4" width="60px" alt="User avatar: Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://avatars.githubusercontent.com/u/54533224?u=a49ea000a8f52adb31382ea69a1a7501b27fefdd&v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https://avatars.githubusercontent.com/u/58894405?v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/jdiegmueller"><img src="https://avatars.githubusercontent.com/u/18660571?u=601d0a23040a271c86b5d40339f899a6dbf27086&v=4" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://avatars.githubusercontent.com/u/105566568?v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/zepled112"><img src="https://avatars.githubusercontent.com/u/65176625?v=4" width="60px" alt="User avatar: wyatt" /></a><a href="https://github.com/altugtekiner"><img src="https://avatars.githubusercontent.com/u/105917451?u=ee73ff639c7bd9feb4708ab4ba7b14eff80196f7&v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/robertsandrock"><img src="https://avatars.githubusercontent.com/u/12015331?u=76849d3cb36b420922d235299558e00a09f2f8b4&v=4" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/mmomega"><img src="https://avatars.githubusercontent.com/u/71956566?v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/KenichiQaz"><img src="https://avatars.githubusercontent.com/u/31177857?u=efdbae734a4c60a7bb95df4659d0535e60a6fd57&v=4" width="60px" alt="User avatar: Stefan" /></a><a href="https://github.com/paulsheets"><img src="https://avatars.githubusercontent.com/u/45240946?u=d4db66f8e8d7a2606fe7a5521daf48ca9f097105&v=4" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https://avatars.githubusercontent.com/u/4107092?v=4" width="60px" alt="User avatar: Dave Jones" /></a><a href="https://github.com/anthonymendez"><img src="https://avatars.githubusercontent.com/u/19240897?u=f82b4be098cac65c8421421b70ebd2d1da85c67e&v=4" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/claudemods"><img src="https://avatars.githubusercontent.com/u/73653396?u=d64c656fb8db24ef56bb000197532df9b618d06c&v=4" width="60px" alt="User avatar: Claudemods" /></a><a href="https://github.com/FatBastard0"><img src="https://avatars.githubusercontent.com/u/173957728?v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/Ascent7910"><img src="https://avatars.githubusercontent.com/u/118260621?v=4" width="60px" alt="User avatar: Max" /></a><a href="https://github.com/DursleyGuy"><img src="https://avatars.githubusercontent.com/u/140165544?v=4" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/YamiSandman616"><img src="https://avatars.githubusercontent.com/u/183505690?u=c3bd20157058b6215e28f7568d4f8c4fbbe92838&v=4" width="60px" alt="User avatar: Sandman616" /></a><a href="https://github.com/realmuddy"><img src="https://avatars.githubusercontent.com/u/30978236?v=4" width="60px" alt="User avatar: Phillip Waters" /></a><a href="https://github.com/quaszi"><img src="https://avatars.githubusercontent.com/u/51266738?u=2e3185214607e51239c5969c866ddd5eb1bdee48&v=4" width="60px" alt="User avatar: " /></a><a href="https://github.com/Psyhackological"><img src="https://avatars.githubusercontent.com/u/47569716?u=66dc5e86731eaf8c6bc78a1bff34420ed2e5402b&v=4" width="60px" alt="User avatar: Konrad Konieczny" /></a><!-- sponsors -->
|
<!-- sponsors --><a href="https://github.com/TriHydera"><img src="https://github.com/TriHydera.png" width="60px" alt="User avatar: TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://github.com/jozozovko.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DelDongo"><img src="https://github.com/DelDongo.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="User avatar: Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://github.com/AlanTristar.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/zepled112"><img src="https://github.com/zepled112.png" width="60px" alt="User avatar: wyatt" /></a><a href="https://github.com/altugtekiner"><img src="https://github.com/altugtekiner.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/mmomega"><img src="https://github.com/mmomega.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="User avatar: Stefan" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="User avatar: Dave Jones" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/claudemods"><img src="https://github.com/claudemods.png" width="60px" alt="User avatar: Claudemods" /></a><a href="https://github.com/FatBastard0"><img src="https://github.com/FatBastard0.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/Ascent7910"><img src="https://github.com/Ascent7910.png" width="60px" alt="User avatar: Max" /></a><a href="https://github.com/DursleyGuy"><img src="https://github.com/DursleyGuy.png" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/YamiSandman616"><img src="https://github.com/YamiSandman616.png" width="60px" alt="User avatar: Sandman616" /></a><a href="https://github.com/realmuddy"><img src="https://github.com/realmuddy.png" width="60px" alt="User avatar: Phillip Waters" /></a><a href="https://github.com/quaszi"><img src="https://github.com/quaszi.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/Psyhackological"><img src="https://github.com/Psyhackological.png" width="60px" alt="User avatar: Konrad Konieczny" /></a><!-- sponsors -->
|
||||||
|
|
||||||
## 🏅 Thanks to all Contributors
|
## 🏅 Thanks to all Contributors
|
||||||
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# Import the function (adjust the path according to your setup)
|
# Import the function (adjust the path according to your setup)
|
||||||
. "./functions/private/Get-WinUtilWingetLatest.ps1"
|
. "./functions/private/Install-WinUtilWinget.ps1"
|
||||||
|
. "./functions/private/Test-WinUtilPackageManager.ps1"
|
||||||
|
|
||||||
# Set up Information stream to be visible
|
# Set up Information stream to be visible
|
||||||
$InformationPreference = "Continue"
|
$InformationPreference = "Continue"
|
||||||
@ -7,20 +8,7 @@ $InformationPreference = "Continue"
|
|||||||
Write-Host "Starting Winget installation test..." -ForegroundColor Cyan
|
Write-Host "Starting Winget installation test..." -ForegroundColor Cyan
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Test the function with verbose output
|
Install-WinUtilWinget
|
||||||
Write-Host "Attempting to run Get-WinUtilWingetLatest..." -ForegroundColor Cyan
|
|
||||||
Get-WinUtilWingetLatest -Verbose
|
|
||||||
|
|
||||||
# Verify Winget is working
|
|
||||||
if (Get-Command winget -ErrorAction SilentlyContinue) {
|
|
||||||
Write-Host "Success! Winget is installed and accessible." -ForegroundColor Green
|
|
||||||
|
|
||||||
# Display Winget version
|
|
||||||
Write-Host "`nWinget version:" -ForegroundColor Cyan
|
|
||||||
winget --version
|
|
||||||
} else {
|
|
||||||
Write-Host "Warning: Winget is installed but not accessible in the current session. You may need to restart your terminal." -ForegroundColor Yellow
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "Error occurred during testing: $($_.Exception.Message)" -ForegroundColor Red
|
Write-Host "Error occurred during testing: $($_.Exception.Message)" -ForegroundColor Red
|
||||||
Write-Host "Stack Trace:" -ForegroundColor Red
|
Write-Host "Stack Trace:" -ForegroundColor Red
|
||||||
|
@ -1,104 +0,0 @@
|
|||||||
function Get-WinUtilWingetLatest {
|
|
||||||
[CmdletBinding()]
|
|
||||||
param()
|
|
||||||
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Uses GitHub API to check for the latest release of Winget.
|
|
||||||
.DESCRIPTION
|
|
||||||
This function first attempts to update WinGet using winget itself, then falls back to manual installation if needed.
|
|
||||||
#>
|
|
||||||
$ProgressPreference = "SilentlyContinue"
|
|
||||||
$InformationPreference = 'Continue'
|
|
||||||
|
|
||||||
try {
|
|
||||||
$wingetCmd = Get-Command winget -ErrorAction Stop
|
|
||||||
Write-Information "Attempting to update WinGet using WinGet..."
|
|
||||||
$result = Start-Process -FilePath "`"$($wingetCmd.Source)`"" -ArgumentList "install -e --accept-source-agreements --accept-package-agreements Microsoft.AppInstaller" -Wait -NoNewWindow -PassThru
|
|
||||||
if ($result.ExitCode -ne 0) {
|
|
||||||
throw "WinGet update failed with exit code: $($result.ExitCode)"
|
|
||||||
}
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Information "WinGet not found or update failed. Attempting to install from Microsoft Store..."
|
|
||||||
try {
|
|
||||||
# Try to close any running WinGet processes
|
|
||||||
Get-Process -Name "DesktopAppInstaller", "winget" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
||||||
Write-Information "Stopping running WinGet process..."
|
|
||||||
$_.Kill()
|
|
||||||
Start-Sleep -Seconds 2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Try to load Windows Runtime assemblies more reliably
|
|
||||||
$null = [System.Runtime.WindowsRuntime.WindowsRuntimeSystemExtensions]
|
|
||||||
Add-Type -AssemblyName System.Runtime.WindowsRuntime
|
|
||||||
|
|
||||||
# Load required assemblies from Windows SDK
|
|
||||||
$null = @(
|
|
||||||
[Windows.Management.Deployment.PackageManager, Windows.Management.Deployment, ContentType = WindowsRuntime]
|
|
||||||
[Windows.Foundation.Uri, Windows.Foundation, ContentType = WindowsRuntime]
|
|
||||||
[Windows.Management.Deployment.DeploymentOptions, Windows.Management.Deployment, ContentType = WindowsRuntime]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Initialize PackageManager
|
|
||||||
$packageManager = New-Object Windows.Management.Deployment.PackageManager
|
|
||||||
|
|
||||||
# Rest of the Microsoft Store installation logic
|
|
||||||
$appxPackage = "https://aka.ms/getwinget"
|
|
||||||
$uri = New-Object Windows.Foundation.Uri($appxPackage)
|
|
||||||
$deploymentOperation = $packageManager.AddPackageAsync($uri, $null, "Add")
|
|
||||||
|
|
||||||
# Add timeout check for deployment operation
|
|
||||||
$timeout = 300
|
|
||||||
$timer = [System.Diagnostics.Stopwatch]::StartNew()
|
|
||||||
|
|
||||||
while ($deploymentOperation.Status -eq 0) {
|
|
||||||
if ($timer.Elapsed.TotalSeconds -gt $timeout) {
|
|
||||||
throw "Installation timed out after $timeout seconds"
|
|
||||||
}
|
|
||||||
Start-Sleep -Milliseconds 100
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($deploymentOperation.Status -eq 1) {
|
|
||||||
Write-Information "Successfully installed WinGet from Microsoft Store"
|
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
throw "Installation failed with status: $($deploymentOperation.Status)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch [System.Management.Automation.RuntimeException] {
|
|
||||||
Write-Information "Windows Runtime components not available. Attempting manual download..."
|
|
||||||
try {
|
|
||||||
# Try to close any running WinGet processes
|
|
||||||
Get-Process -Name "DesktopAppInstaller", "winget" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
||||||
Write-Information "Stopping running WinGet process..."
|
|
||||||
$_.Kill()
|
|
||||||
Start-Sleep -Seconds 2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Fallback to direct download from GitHub
|
|
||||||
$apiUrl = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
|
|
||||||
$release = Invoke-RestMethod -Uri $apiUrl
|
|
||||||
$msixBundleUrl = ($release.assets | Where-Object { $_.name -like "*.msixbundle" }).browser_download_url
|
|
||||||
|
|
||||||
$tempFile = Join-Path $env:TEMP "Microsoft.DesktopAppInstaller.msixbundle"
|
|
||||||
Invoke-WebRequest -Uri $msixBundleUrl -OutFile $tempFile
|
|
||||||
|
|
||||||
Add-AppxPackage -Path $tempFile -ErrorAction Stop
|
|
||||||
Remove-Item $tempFile -Force
|
|
||||||
|
|
||||||
Write-Information "Successfully installed WinGet from GitHub release"
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Error "Failed to install WinGet: $_"
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Error "Failed to install WinGet: $_"
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -33,18 +33,118 @@ function Install-WinUtilWinget {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install Winget via GitHub method.
|
Write-Host "Attempting to install/update Winget`r"
|
||||||
# Used part of my own script with some modification: ruxunderscore/windows-initialization
|
try {
|
||||||
Write-Host "Downloading Winget and License File`r"
|
$wingetCmd = Get-Command winget -ErrorAction Stop
|
||||||
Get-WinUtilWingetLatest
|
Write-Information "Attempting to update WinGet using WinGet..."
|
||||||
Write-Host "Enabling NuGet and Module..."
|
$result = Start-Process -FilePath "`"$($wingetCmd.Source)`"" -ArgumentList "install -e --accept-source-agreements --accept-package-agreements Microsoft.AppInstaller" -Wait -NoNewWindow -PassThru
|
||||||
Install-PackageProvider -Name NuGet -Force
|
if ($result.ExitCode -ne 0) {
|
||||||
Install-Module -Name Microsoft.WinGet.Client -Force
|
throw "WinGet update failed with exit code: $($result.ExitCode)"
|
||||||
# Winget only needs a refresh of the environment variables to be used.
|
}
|
||||||
|
Write-Output "Refreshing Environment Variables...`n"
|
||||||
|
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
|
return
|
||||||
|
} catch {
|
||||||
|
Write-Information "WinGet not found or update failed. Attempting to install from Microsoft Store..."
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
# Try to close any running WinGet processes
|
||||||
|
Get-Process -Name "DesktopAppInstaller", "winget" -ErrorAction SilentlyContinue | ForEach-Object {
|
||||||
|
Write-Information "Stopping running WinGet process..."
|
||||||
|
$_.Kill()
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Try to load Windows Runtime assemblies more reliably
|
||||||
|
$null = [System.Runtime.WindowsRuntime.WindowsRuntimeSystemExtensions]
|
||||||
|
Add-Type -AssemblyName System.Runtime.WindowsRuntime
|
||||||
|
|
||||||
|
# Load required assemblies from Windows SDK
|
||||||
|
$null = @(
|
||||||
|
[Windows.Management.Deployment.PackageManager, Windows.Management.Deployment, ContentType = WindowsRuntime]
|
||||||
|
[Windows.Foundation.Uri, Windows.Foundation, ContentType = WindowsRuntime]
|
||||||
|
[Windows.Management.Deployment.DeploymentOptions, Windows.Management.Deployment, ContentType = WindowsRuntime]
|
||||||
|
)
|
||||||
|
|
||||||
|
# Initialize PackageManager
|
||||||
|
$packageManager = New-Object Windows.Management.Deployment.PackageManager
|
||||||
|
|
||||||
|
# Rest of the Microsoft Store installation logic
|
||||||
|
$appxPackage = "https://aka.ms/getwinget"
|
||||||
|
$uri = New-Object Windows.Foundation.Uri($appxPackage)
|
||||||
|
$deploymentOperation = $packageManager.AddPackageAsync($uri, $null, "Add")
|
||||||
|
|
||||||
|
# Add timeout check for deployment operation
|
||||||
|
$timeout = 300
|
||||||
|
$timer = [System.Diagnostics.Stopwatch]::StartNew()
|
||||||
|
|
||||||
|
while ($deploymentOperation.Status -eq 0) {
|
||||||
|
if ($timer.Elapsed.TotalSeconds -gt $timeout) {
|
||||||
|
throw "Installation timed out after $timeout seconds"
|
||||||
|
}
|
||||||
|
Start-Sleep -Milliseconds 100
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($deploymentOperation.Status -eq 1) {
|
||||||
|
Write-Information "Successfully installed WinGet from Microsoft Store"
|
||||||
|
Write-Output "Refreshing Environment Variables...`n"
|
||||||
|
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
throw "Installation failed with status: $($deploymentOperation.Status)"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Information "Microsoft Store installation failed. Attempting to install from Nuget..."
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
## Nuget Method
|
||||||
|
Write-Host "Enabling NuGet and Module..."
|
||||||
|
# Enable TLS 1.2 for the PowerShell session
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
# Try to register the NuGet package source if not present
|
||||||
|
if (-not (Get-PackageSource -Name "NuGet" -ErrorAction SilentlyContinue)) {
|
||||||
|
Register-PackageSource -Name "NuGet" -Location "https://www.nuget.org/api/v2" -ProviderName NuGet -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install NuGet provider with error handling
|
||||||
|
try {
|
||||||
|
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Confirm:$false -ErrorAction Stop
|
||||||
|
} catch {
|
||||||
|
Write-Warning "Failed to install NuGet provider through standard method. Trying alternative approach..."
|
||||||
|
Install-PackageProvider -Name NuGet -Source "https://www.powershellgallery.com/api/v2" -Force -Confirm:$false
|
||||||
|
}
|
||||||
|
Install-Module -Name Microsoft.WinGet.Client -Confirm:$false -Force
|
||||||
|
|
||||||
|
# Check if WinGet was installed successfully through NuGet
|
||||||
|
$wingetCmd = Get-Command winget -ErrorAction Stop
|
||||||
|
Write-Information "Successfully installed WinGet through NuGet"
|
||||||
|
Write-Output "Refreshing Environment Variables...`n"
|
||||||
|
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
|
return
|
||||||
|
} catch {
|
||||||
|
Write-Warning "NuGet installation failed. Attempting to install from GitHub..."
|
||||||
|
}
|
||||||
|
# GitHub fallback installation method
|
||||||
|
$releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
|
||||||
|
$asset = (Invoke-RestMethod -Uri $releases_url).assets |
|
||||||
|
Where-Object { $_.name -match "\.msixbundle$" } |
|
||||||
|
Select-Object -First 1
|
||||||
|
|
||||||
|
$download_url = $asset.browser_download_url
|
||||||
|
$output_path = Join-Path $env:TEMP $asset.name
|
||||||
|
|
||||||
|
Invoke-WebRequest -Uri $download_url -OutFile $output_path
|
||||||
|
Add-AppxPackage -Path $output_path -ErrorAction Stop
|
||||||
|
|
||||||
|
# Verify installation
|
||||||
|
$wingetCmd = Get-Command winget -ErrorAction Stop
|
||||||
|
Write-Information "Successfully installed WinGet through GitHub"
|
||||||
Write-Output "Refreshing Environment Variables...`n"
|
Write-Output "Refreshing Environment Variables...`n"
|
||||||
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
$ENV:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
|
return
|
||||||
} catch {
|
} catch {
|
||||||
Write-Error "Failed to install Winget: $($_.Exception.Message)"
|
Write-Error "All installation methods failed. Unable to install WinGet."
|
||||||
|
throw
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user