Brief description of your issue
Package installs successfully via winget CLI, but fails via
Microsoft.WinGet.DSC/WinGetPackage.
Error:
Invoke-Winget.ps1 attempts to read temp *.err.txt file that was never created,
causing DSC to fail even when installer succeeds.
Expected:
DSC should not assume stderr file exists when process exits 0.
Workaround:
Use Script resource and call winget.exe directly.
Steps to reproduce
Repro:
- Use Microsoft.WinGet.DSC/WinGetPackage
- Install any EXE/MSI bootstrapper (SSMS, VS Code, Terraform, Azure Functions Core Tools)
- Run via winget configure / provisioning context
e.g.
# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
configurationVersion: 0.2.0
resources:
# SSMS — install via WinGetPackage
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: ssms
directives:
description: 'Install SQL Server Management Studio silently'
securityContext: elevated
settings:
id: Microsoft.SQLServerManagementStudio
source: winget
ensure: Present
installMode: silent
- DSC fails with Get-Content PathNotFoundException
Expected behavior
Expected:
DSC should not assume stderr file exists when process exits 0.
Workaround:
Use Script resource and call winget.exe directly.
Actual behavior
Winget log output from Microsoft Dev Box Image definitions build:
[2026-02-23T09:47:52.484131+00:00] PowerShell 7 is already installed
[2026-02-23T09:47:52.491110+00:00] Installing powershell modules in scope: AllUsers
[2026-02-23T09:47:54.142157+00:00] NuGet provider is already installed
[2026-02-23T09:48:04.651119+00:00] Microsoft.Winget.Client is already installed
[2026-02-23T09:48:05.208530+00:00] Microsoft.WinGet.Configuration is already installed
[2026-02-23T09:48:05.209519+00:00] Updating WinGet
[2026-02-23T09:48:05.210467+00:00] Attempting to repair WinGet Package Manager
[2026-02-23T09:48:06.032270+00:00] �[33;1mVERBOSE: Already running on MTA�[0m
[2026-02-23T09:48:06.426594+00:00] �[33;1mVERBOSE: WinGet is in a good state.�[0m
[2026-02-23T09:48:06.515237+00:00] Done Reparing WinGet Package Manager
[2026-02-23T09:48:12.638703+00:00] Running in the provisioning context
[2026-02-23T09:48:12.642436+00:00] Running installation of configuration file: C:\WinGetConfig<ourproject><ourpath>\ImageDefinitions\customizations\common-ui.dsc.yaml
[2026-02-23T09:49:30.616461+00:00] Get-Content : Cannot find path 'C:\Windows\SystemTemp\tmpA12E.tmp.err.txt' because it does not exist.
[2026-02-23T09:49:30.616551+00:00] At C:\Windows\SystemTemp\c3b87e0b-5e47-4130-bdc4-2e2ab07649a0\vo2h05j2.mc5\Invoke-Winget.ps1:398 char:29
[2026-02-23T09:49:30.616553+00:00] + $errorDetails = Get-Content -Path $tempErrFile
[2026-02-23T09:49:30.616572+00:00] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2026-02-23T09:49:30.616648+00:00] + CategoryInfo : ObjectNotFound: (C:\Windows\Syst...12E.tmp.err.txt:String) [Get-Content], ItemNotFoundEx
[2026-02-23T09:49:30.616718+00:00] ception
[2026-02-23T09:49:30.616777+00:00] + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
[2026-02-23T09:49:30.616836+00:00]
[2026-02-23T09:49:30.619600+00:00] Failed to run configuration file installation. Exit code: 255 Details:
[2026-02-23T09:49:30.635662+00:00]
[2026-02-23T09:49:30.635960+00:00]
Environment
This is the Winget version that Microsoft Dev Box leverages, as part of the build process.
Brief description of your issue
Package installs successfully via winget CLI, but fails via
Microsoft.WinGet.DSC/WinGetPackage.
Error:
Invoke-Winget.ps1 attempts to read temp *.err.txt file that was never created,
causing DSC to fail even when installer succeeds.
Expected:
DSC should not assume stderr file exists when process exits 0.
Workaround:
Use Script resource and call winget.exe directly.
Steps to reproduce
Repro:
e.g.
Expected behavior
Expected:
DSC should not assume stderr file exists when process exits 0.
Workaround:
Use Script resource and call winget.exe directly.
Actual behavior
Winget log output from Microsoft Dev Box Image definitions build:
[2026-02-23T09:47:52.484131+00:00] PowerShell 7 is already installed
[2026-02-23T09:47:52.491110+00:00] Installing powershell modules in scope: AllUsers
[2026-02-23T09:47:54.142157+00:00] NuGet provider is already installed
[2026-02-23T09:48:04.651119+00:00] Microsoft.Winget.Client is already installed
[2026-02-23T09:48:05.208530+00:00] Microsoft.WinGet.Configuration is already installed
[2026-02-23T09:48:05.209519+00:00] Updating WinGet
[2026-02-23T09:48:05.210467+00:00] Attempting to repair WinGet Package Manager
[2026-02-23T09:48:06.032270+00:00] �[33;1mVERBOSE: Already running on MTA�[0m
[2026-02-23T09:48:06.426594+00:00] �[33;1mVERBOSE: WinGet is in a good state.�[0m
[2026-02-23T09:48:06.515237+00:00] Done Reparing WinGet Package Manager
[2026-02-23T09:48:12.638703+00:00] Running in the provisioning context
[2026-02-23T09:48:12.642436+00:00] Running installation of configuration file: C:\WinGetConfig<ourproject><ourpath>\ImageDefinitions\customizations\common-ui.dsc.yaml
[2026-02-23T09:49:30.616461+00:00] Get-Content : Cannot find path 'C:\Windows\SystemTemp\tmpA12E.tmp.err.txt' because it does not exist.
[2026-02-23T09:49:30.616551+00:00] At C:\Windows\SystemTemp\c3b87e0b-5e47-4130-bdc4-2e2ab07649a0\vo2h05j2.mc5\Invoke-Winget.ps1:398 char:29
[2026-02-23T09:49:30.616553+00:00] + $errorDetails = Get-Content -Path $tempErrFile
[2026-02-23T09:49:30.616572+00:00] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2026-02-23T09:49:30.616648+00:00] + CategoryInfo : ObjectNotFound: (C:\Windows\Syst...12E.tmp.err.txt:String) [Get-Content], ItemNotFoundEx
[2026-02-23T09:49:30.616718+00:00] ception
[2026-02-23T09:49:30.616777+00:00] + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
[2026-02-23T09:49:30.616836+00:00]
[2026-02-23T09:49:30.619600+00:00] Failed to run configuration file installation. Exit code: 255 Details:
[2026-02-23T09:49:30.635662+00:00]
[2026-02-23T09:49:30.635960+00:00]
Environment