diff --git a/Tasks/git-clone/main.ps1 b/Tasks/git-clone/main.ps1 index 144a9a6..f506c24 100644 --- a/Tasks/git-clone/main.ps1 +++ b/Tasks/git-clone/main.ps1 @@ -266,9 +266,9 @@ function InstallPackage{ # if winget is available, use it to install package if (Get-Command winget -ErrorAction SilentlyContinue) { Write-Host "Installing $PackageId with winget" - winget install --id $PackageId -e --source winget + winget install --id $PackageId -e --source winget --silent $installExitCode = $LASTEXITCODE - Write-Host "'winget install --id $PackageId -e --source winget' exited with code: $($installExitCode)" + Write-Host "'winget install --id $PackageId -e --source winget --silent' exited with code: $($installExitCode)" if ($installExitCode -eq 0) { # add package path to path $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + ";" + $PackagePath @@ -296,7 +296,7 @@ function InstallPackage{ $tempOutFile = [System.IO.Path]::GetTempFileName() + ".out.json" $installCommandBlock = { - $installPackageCommand = "Install-WinGetPackage -Scope $($scopeFlagValue) -Source winget -Id $($PackageId) | ConvertTo-Json -Depth 10 | Tee-Object -FilePath '$($tempOutFile)'" + $installPackageCommand = "Install-WinGetPackage -Scope $($scopeFlagValue) -Mode Silent -Source winget -Id $($PackageId) | ConvertTo-Json -Depth 10 | Tee-Object -FilePath '$($tempOutFile)'" $processCreation = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine="C:\Program Files\PowerShell\7\pwsh.exe $($mtaFlag) -Command `"$($installPackageCommand)`""} if (!($processCreation) -or !($processCreation.ProcessId)) { Write-Error "Failed to install $PackageId package. Process creation failed." diff --git a/Tasks/winget/main.ps1 b/Tasks/winget/main.ps1 index 002de98..066c0d1 100644 --- a/Tasks/winget/main.ps1 +++ b/Tasks/winget/main.ps1 @@ -337,7 +337,7 @@ if ($RunAsUser -eq "true") { $versionFlag = "--version `"$($Version)`"" } Write-Host "Appending package install: $($Package)" - AppendToUserScript "winget install --id `"$($Package)`" $($versionFlag) --accept-source-agreements --accept-package-agreements" + AppendToUserScript "winget install --id `"$($Package)`" $($versionFlag) --accept-source-agreements --accept-package-agreements --silent" AppendToUserScript "Write-Host `"winget exit code: `$LASTEXITCODE`"" } # We're running in configuration file mode: @@ -373,7 +373,7 @@ else { } $installCommandBlock = { - $installPackageCommand = "Install-WinGetPackage -Scope $($scopeFlagValue) -Source winget -Id '$($Package)' $($versionFlag) | ConvertTo-Json -Depth 10 | Tee-Object -FilePath '$($tempOutFile)'" + $installPackageCommand = "Install-WinGetPackage -Scope $($scopeFlagValue) -Mode Silent -Source winget -Id '$($Package)' $($versionFlag) | ConvertTo-Json -Depth 10 | Tee-Object -FilePath '$($tempOutFile)'" $processCreation = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine="C:\Program Files\PowerShell\7\pwsh.exe $($mtaFlag) -Command `"$($installPackageCommand)`""} if (!($processCreation) -or !($processCreation.ProcessId)) { Write-Error "Failed to install package. Process creation failed."