From 5e1b72996ed9a99fa1502ca6eca1e07d8c61d9f0 Mon Sep 17 00:00:00 2001 From: Robin Stolpe Date: Fri, 26 Apr 2024 16:43:22 +0200 Subject: [PATCH] hopeing this works --- WinSoftwareUpdate/WinSoftwareUpdate.psd1 | 2 +- WinSoftwareUpdate/WinSoftwareUpdate.psm1 | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/WinSoftwareUpdate/WinSoftwareUpdate.psd1 b/WinSoftwareUpdate/WinSoftwareUpdate.psd1 index 32c7fe0..2074da5 100644 --- a/WinSoftwareUpdate/WinSoftwareUpdate.psd1 +++ b/WinSoftwareUpdate/WinSoftwareUpdate.psd1 @@ -134,7 +134,7 @@ ReleaseNotes = 'https://github.com/rstolpe/WinSoftwareUpdate/releases' # Prerelease string of this module - Prerelease = 'beta3' + Prerelease = 'beta4' # Flag to indicate whether the module requires explicit user acceptance for install/update/save RequireLicenseAcceptance = $false diff --git a/WinSoftwareUpdate/WinSoftwareUpdate.psm1 b/WinSoftwareUpdate/WinSoftwareUpdate.psm1 index 89713f3..82516f2 100644 --- a/WinSoftwareUpdate/WinSoftwareUpdate.psm1 +++ b/WinSoftwareUpdate/WinSoftwareUpdate.psm1 @@ -79,7 +79,7 @@ Function Confirm-rsWinGet { [System.Object]$GithubInfoRestData = Invoke-RestMethod -Uri $WinGetUrl -Method Get -Headers $GithubHeaders -TimeoutSec 10 -HttpVersion $SysInfo.HTTPVersion | Select-Object -Property assets, tag_name [System.Object]$GitHubInfo = [PSCustomObject]@{ - Tag = $($GithubInfoRestData.tag_name.Substring(1)) -as [version] + Tag = $($GithubInfoRestData.tag_name.Substring(1)) DownloadUrl = $GithubInfoRestData.assets | where-object { $_.name -like "*.msixbundle" } | Select-Object -ExpandProperty browser_download_url OutFile = "$($env:TEMP)\WinGet_$($GithubInfoRestData.tag_name.Substring(1)).msixbundle" } @@ -361,11 +361,20 @@ Function Update-rsWinSoftware { # Checking if it's any softwares to update and if so it will update them Write-Output "Updating Wingets source list..." - Start-Process -FilePath "WinGet.exe" -ArgumentList "source update" -Verb RunAS -NoNewWindow -Wait + Start-Process -FilePath "WinGet.exe" -ArgumentList "source update" -NoNewWindow -Wait Write-OutPut "Checks if any softwares needs to be updated..." try { - Start-Process -FilePath "WinGet.exe" -ArgumentList "upgrade --all --accept-package-agreements --accept-source-agreements --silent --include-unknown --uninstall-previous" -Verb RunAS -NoNewWindow -Wait + $Arguments = @() + $Arguments += "upgrade" + $Arguments += "--all" + $Arguments += "--include-unknown" + $Arguments += "--accept-package-agreements" + $Arguments += "--accept-source-agreements" + $Arguments += "--uninstall-previous" + $Arguments += "--silent" + + Start-Process -FilePath "WinGet.exe" -ArgumentList $Arguments -NoNewWindow -Wait } catch { Write-Error "Message: $($_.Exception.Message)`nError Line: $($_.InvocationInfo.Line)`n"