You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
When using the ReplaceText DSC resource in order to Append Text to a blank/empty text file, the resource throws an error "Exception calling "Matches" with "2" argument(s): "Value cannot be null. Parameter name: input"
Verbose logs showing the problem
Suggested solution to the issue
Enable the resource to handle blank/empty file scenarios. The issue occurs due to $fileContent having a null value, which is expected when the file is blank.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
configurationBlankFileScenario
{
Import-DscResource-ModuleName FileContentDsc
node localhost
{
ReplaceText "BlankEmpty File"
{
Path ='C:\Dev\blankFile.txt'#blank file -> Get-Content should be true when compared to $null
Search ='search'
Type ='Text'
Text ='replacement'
AllowAppend =$true
}
}
}
The operating system the target node is running
Windows Server 2012 R2
Version and build of PowerShell the target node is running
5.1.14409.1018
Version of the DSC module that was used ('dev' if using current dev branch)
1.1.0.108
The text was updated successfully, but these errors were encountered:
Details of the scenario you tried and the problem that is occurring
When using the ReplaceText DSC resource in order to Append Text to a blank/empty text file, the resource throws an error "Exception calling "Matches" with "2" argument(s): "Value cannot be null. Parameter name: input"
Verbose logs showing the problem
Suggested solution to the issue
Enable the resource to handle blank/empty file scenarios. The issue occurs due to $fileContent having a null value, which is expected when the file is blank.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
Windows Server 2012 R2
Version and build of PowerShell the target node is running
5.1.14409.1018
Version of the DSC module that was used ('dev' if using current dev branch)
1.1.0.108
The text was updated successfully, but these errors were encountered: