Carbon_IniFile DSC Resource does not remove last entry in file

Issue #179 resolved
Anonymous created an issue

Using Carbon 2.1.0

The following DSC resource configuration does not remove MyKey entry from the file if it is the only remaining key in the file.

 Carbon_IniFile ServerUrl
  {
    Ensure = 'Absent'
    Path = 'c:\file.ini'
    Name = 'MyKey'
  }

Comments (4)

  1. Aaron Jensen repo owner

    You can workaround this issue by adding a blank line to the file. The bug is due to the behavior of Set-Content: when passed an empty array, it doesn't set the file. When you remove the last entry from an INI file and that entry is the only line of the file, the array of lines to set to the file is empty.

  2. Log in to comment