Details of the scenario you tried and the problem that is occurring
Hi, I was trying to run KeyValuePairFile from FileContentDsc on an empty .config file to try to populate some new entries. Not sure if this is supported or not or if I should be using a different DSC resource, but I kept getting errors, I'm assuming because the file was empty and everything the DSC resource was trying to work with was null.
Realistically, for what I'm going to be using this for, I won't be having this issue. Just figured I'd bring it up since I ran into it.
Verbose logs showing the problem
This was in my event viewer for operational DSC logs:
Event 4252 -
Job {43432191-A78D-11E9-837E-408D5C58C088} :
MIResult: 1
Error Message: Exception calling "Matches" with "3" argument(s): "Value cannot be null.
Parameter name: input"
Message ID: ArgumentNullException
Error Category: 0
Error Code: 1
Error Type: MI
From Get-DscConfigurationStatus -
Get-DscConfigurationStatus | select -ExpandProperty ResourcesnotInDesiredState
ConfigurationName : splunkServerConfconfig
DependsOn :
ModuleName : FileContentDsc
ModuleVersion : 1.1.0.108
PsDscRunAsCredential :
ResourceId : [KeyValuePairFile]splunkServerConf_serverCert
SourceInfo : ::15::9::KeyValuePairFile
DurationInSeconds : 0.067
Error : {
"Exception": {
"Message": "The PowerShell DSC resource \u0027[KeyValuePairFile]splunkServerConf_serverCert\u0027 with SourceInfo \u0027::15::9::KeyValuePairFile\u0027 threw one or more non-terminating
errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.",
"Data": {
},
"InnerException": null,
"TargetSite": null,
"StackTrace": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233079
},
"TargetObject": null,
"CategoryInfo": {
"Category": 7,
"Activity": "",
"Reason": "InvalidOperationException",
"TargetName": "",
"TargetType": ""
},
"FullyQualifiedErrorId": "NonTerminatingErrorFromProvider",
"ErrorDetails": null,
"InvocationInfo": null,
"ScriptStackTrace": null,
"PipelineIterationInfo": [
]
}
FinalState :
InDesiredState : False
InitialState :
InstanceName : splunkServerConf_serverCert
RebootRequested : False
ResourceName : KeyValuePairFile
StartDate : 7/15/2019 11:01:41 PM
StateChanged : False
PSComputerName :
ConfigurationName : splunkServerConfconfig
DependsOn :
ModuleName : FileContentDsc
ModuleVersion : 1.1.0.108
PsDscRunAsCredential :
ResourceId : [KeyValuePairFile]splunkServerConf_sslPassword
SourceInfo : ::24::9::KeyValuePairFile
DurationInSeconds : 0.01
Error : {
"Exception": {
"Message": "The PowerShell DSC resource \u0027[KeyValuePairFile]splunkServerConf_sslPassword\u0027 with SourceInfo \u0027::24::9::KeyValuePairFile\u0027 threw one or more non-terminating
errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.",
"Data": {
},
"InnerException": null,
"TargetSite": null,
"StackTrace": null,
"HelpLink": null,
"Source": null,
"HResult": -2146233079
},
"TargetObject": null,
"CategoryInfo": {
"Category": 7,
"Activity": "",
"Reason": "InvalidOperationException",
"TargetName": "",
"TargetType": ""
},
"FullyQualifiedErrorId": "NonTerminatingErrorFromProvider",
"ErrorDetails": null,
"InvocationInfo": null,
"ScriptStackTrace": null,
"PipelineIterationInfo": [
]
}
FinalState :
InDesiredState : False
InitialState :
InstanceName : splunkServerConf_sslPassword
RebootRequested : False
ResourceName : KeyValuePairFile
StartDate : 7/15/2019 11:01:41 PM
StateChanged : False
PSComputerName :
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Configuration splunkServerConfconfig
{
[Cmdletbinding()]
param
(
[parameter()]
[string[]]
$NodeName = 'localhost'
)
Import-DscResource -ModuleName FileContentDsc
Node $NodeName
{
KeyValuePairFile splunkServerConf_serverCert
{
Path = "B:\Code\GitHub\PowerShell\SplunkDSCTest\server.conf"
Name = "serverCert"
Text = "B:\fakecert.pem"
Type = "Text"
Ensure = "Present"
}
KeyValuePairFile splunkServerConf_sslPassword
{
Path = "B:\Code\GitHub\PowerShell\SplunkDSCTest\server.conf"
Name = "sslPassword"
Text = "passwordpassword"
Type = "Text"
Ensure = "Present"
}
}
}
Version and build of PowerShell the target node is running
Name Value
PSVersion 5.1.17763.592
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.592
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
1.1.0.108