Skip to content

Commit

Permalink
Applying a winget config as system shoulnd use pwsh -MTA
Browse files Browse the repository at this point in the history
This mitigates the issue fixed by microsoft/winget-cli#4669 until that code is released.
  • Loading branch information
DavidObando committed Jul 31, 2024
1 parent 4d5d687 commit 963fa77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Tasks/winget/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ else {
elseif ($ConfigurationFile) {
Write-Host "Running installation of configuration file: $($ConfigurationFile)"

$processCreation = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine="C:\Program Files\PowerShell\7\pwsh.exe $($mtaFlag) -Command `"Get-WinGetConfiguration -File '$($ConfigurationFile)' | Invoke-WinGetConfiguration -AcceptConfigurationAgreements | Select-Object -ExpandProperty UnitResults | ConvertTo-Json -Depth 10 > $($tempOutFile)`""}
$processCreation = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine="C:\Program Files\PowerShell\7\pwsh.exe -Command `"Get-WinGetConfiguration -File '$($ConfigurationFile)' | Invoke-WinGetConfiguration -AcceptConfigurationAgreements | Select-Object -ExpandProperty UnitResults | ConvertTo-Json -Depth 10 > $($tempOutFile)`""}
$process = Get-Process -Id $processCreation.ProcessId
$handle = $process.Handle # cache process.Handle so ExitCode isn't null when we need it below
$process.WaitForExit()
Expand Down

0 comments on commit 963fa77

Please sign in to comment.