Skip to content

Instantly share code, notes, and snippets.

@egerlach
Last active November 8, 2023 19:40
Show Gist options
  • Save egerlach/834d62d20fe68122c4389d8ff8a94440 to your computer and use it in GitHub Desktop.
Save egerlach/834d62d20fe68122c4389d8ff8a94440 to your computer and use it in GitHub Desktop.
FileContentDsc fails in winget configure
properties:
configurationVersion: '0.2.0'
resources:
- directives:
allowPrerelease: true
resource: FileContentDsc/KeyValuePairFile
settings:
Ensure: Present
Name: foo
Path: "C:\\Users\\egerlach\\test.conf"
Text: bar
PS C:\Users\egerlach\src\workstation-setup> cat C:\Users\egerlach\test.conf
foo=false
PS C:\Users\egerlach\src\workstation-setup> Invoke-DscResource -Name KeyValuePairFile -Method Set -ModuleName FileContentDsc -Property @{
>> Path = 'c:\Users\egerlach\test.conf'
>> Name = 'foo'
>> Ensure = 'Present'
>> Text = 'bar'
>> }
RebootRequired
--------------
False
PS C:\Users\egerlach\src\workstation-setup> cat C:\Users\egerlach\test.conf
foo=bar
PS C:\Users\egerlach\src\dsc-test> winget configure .\filecontentdsc.yaml --verbose-logs --accept-configuration-agreements
Apply :: KeyValuePairFile
C:\Users\egerlach\test.conf: Set foo to bar
Module: FileContentDsc by DSC Community [Local]
https://github.com/dsccommunity/FileContentDsc
DSC resources for for manipulating the content of text files.
Settings:
Path: C:\Users\egerlach\test.conf
Ensure: Present
Name: foo
Text: bar
You are responsible for understanding the configuration settings you are choosing to execute. Microsoft is not responsible for the configuration file you have authored or imported. This configuration may change settings in Windows, install software, change software settings (including security settings), and accept user agreements to third-party packages and services on your behalf.  By running this configuration file, you acknowledge that you understand and agree to these resources and settings. Any applications installed are licensed to you by their owners. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages or services.
Apply :: KeyValuePairFile
The configuration unit failed while attempting to test the current system state.
Cannot process argument transformation on parameter 'Encoding'. 'byte' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
Cannot index into a null array.
<See the log file for additional details>
Some of the configuration was not applied successfully.
2023-11-07 18:22:11.596 [CORE] WinGet, version [1.6.2771], activity [{F133ADD5-924A-4C6A-B9CB-BDF931A72200}]
2023-11-07 18:22:11.598 [CORE] OS: Windows.Desktop v10.0.22621.2428
2023-11-07 18:22:11.598 [CORE] Command line Args: "C:\Users\egerlach\AppData\Local\Microsoft\WindowsApps\winget.exe" configure .\filecontentdsc.yaml --verbose-logs --accept-configuration-agreements
2023-11-07 18:22:11.598 [CORE] Package: Microsoft.DesktopAppInstaller v1.21.2771.0
2023-11-07 18:22:11.598 [CORE] IsCOMCall:0; Caller: winget-cli
2023-11-07 18:22:11.646 [CLI ] WinGet invoked with arguments: 'configure' '.\filecontentdsc.yaml' '--verbose-logs' '--accept-configuration-agreements'
2023-11-07 18:22:11.646 [CLI ] Found subcommand: configure
2023-11-07 18:22:11.646 [CLI ] Leaf command to execute: root:configure
2023-11-07 18:22:11.647 [CLI ] Executing command: configure
2023-11-07 18:22:11.730 [CONF] Launching process for configuration processing...
2023-11-07 18:22:11.796 [CONF] Configuration remote PID is 30824
2023-11-07 18:22:12.205 [CONF] ... configuration processing connection established.
2023-11-07 18:22:12.216 [CONF] Applying built in additional module path: C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wekyb3d8bbwe\ExternalModules
2023-11-07 18:22:12.803 [CONF] [CONF] Parsing configuration set:
2023-11-07 18:22:12.803 [CONF] properties:
configurationVersion: '0.2.0'
resources:
- directives:
allowPrerelease: true
description: "C:\\Users\\egerlach\\test.conf: Set foo to bar"
resource: FileContentDsc/KeyValuePairFile
settings:
Ensure: Present
Name: foo
Path: "C:\\Users\\egerlach\\test.conf"
Text: 'bar'
2023-11-07 18:22:12.803 [CONF] [YAML] Detected UTF-8
2023-11-07 18:22:12.971 [CONF] Creating set processor for `filecontentdsc.yaml`...
2023-11-07 18:22:17.803 [CONF] Using winget module path
2023-11-07 18:22:17.804 [CONF] Effective module path:
C:\Users\egerlach\AppData\Local\Microsoft\WinGet\Configuration\Modules;C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wekyb3d8bbwe\ExternalModules;C:\Users\egerlach\Oracle Content - Prev\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\windowsapps\microsoft.desktopappinstaller_1.21.2771.0_x64__8wekyb3d8bbwe\configurationremotingserver\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
2023-11-07 18:22:19.869 [CONF] ... done creating set processor.
2023-11-07 18:22:19.926 [CONF] Getting unit details [ReadOnly] for: KeyValuePairFile [FileContentDsc]
2023-11-07 18:22:21.318 [CONF] Creating set processor for `filecontentdsc.yaml`...
2023-11-07 18:22:21.905 [CONF] Using winget module path
2023-11-07 18:22:21.906 [CONF] Effective module path:
C:\Users\egerlach\AppData\Local\Microsoft\WinGet\Configuration\Modules;C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wekyb3d8bbwe\ExternalModules;C:\Users\egerlach\Oracle Content - Prev\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\windowsapps\microsoft.desktopappinstaller_1.21.2771.0_x64__8wekyb3d8bbwe\configurationremotingserver\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
2023-11-07 18:22:22.698 [CONF] ... done creating set processor.
2023-11-07 18:22:22.702 [CONF] Creating unit processor for: KeyValuePairFile [FileContentDsc]...
2023-11-07 18:22:23.733 [CONF] ... done creating unit processor.
2023-11-07 18:22:23.733 [CONF] Using unit from location: C:\Users\egerlach\AppData\Local\Microsoft\WinGet\Configuration\Modules\FileContentDsc\2.0.0\DscResources\DSC_KeyValuePairFile\DSC_KeyValuePairFile.psm1
2023-11-07 18:22:23.739 [CONF] Invoking `Test` for resource: KeyValuePairFile [FileContentDsc]...
2023-11-07 18:22:24.109 [CONF] Microsoft.Management.Configuration.Processor.Exceptions.InvokeDscResourceException: Failed when calling `Test` for resource: KeyValuePairFile [FileContentDsc] Message: 'Cannot process argument transformation on parameter 'Encoding'. 'byte' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
Cannot index into a null array.
'
at Microsoft.Management.Configuration.Processor.DscModule.DscModuleV2.InvokeTestResource(PowerShell pwsh, ValueSet settings, String name, ModuleSpecification moduleSpecification)
at Microsoft.Management.Configuration.Processor.Runspaces.HostedEnvironment.InvokeTestResource(ValueSet settings, String name, ModuleSpecification moduleSpecification)
at Microsoft.Management.Configuration.Processor.Unit.ConfigurationUnitProcessor.TestSettings()
2023-11-07 18:22:24.110 [CONF] ... done invoking `Test`.
2023-11-07 18:22:24.328 [CONF] Configuration unit KeyValuePairFile[] failed with code 0x8a15c105 and error message:
Cannot process argument transformation on parameter 'Encoding'. 'byte' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
Cannot index into a null array.
Microsoft.Management.Configuration.Processor.Exceptions.InvokeDscResourceException: Failed when calling `Test` for resource: KeyValuePairFile [FileContentDsc] Message: 'Cannot process argument transformation on parameter 'Encoding'. 'byte' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
Cannot index into a null array.
'
at Microsoft.Management.Configuration.Processor.DscModule.DscModuleV2.InvokeTestResource(PowerShell pwsh, ValueSet settings, String name, ModuleSpecification moduleSpecification)
at Microsoft.Management.Configuration.Processor.Runspaces.HostedEnvironment.InvokeTestResource(ValueSet settings, String name, ModuleSpecification moduleSpecification)
at Microsoft.Management.Configuration.Processor.Unit.ConfigurationUnitProcessor.TestSettings()
2023-11-07 18:22:24.329 [CLI ] Terminating context: 0x8a15c005 at D:\a\_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\ConfigurationFlow.cpp:3f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment