{"id":19954025,"url":"https://github.com/mkht/dscr_inifile","last_synced_at":"2026-04-14T15:33:39.676Z","repository":{"id":57668247,"uuid":"94783453","full_name":"mkht/DSCR_IniFile","owner":"mkht","description":"THIS MODULE HAS BEEN DEPRECATED Please use DSCR_FileContent instead: ","archived":false,"fork":false,"pushed_at":"2018-10-28T06:09:16.000Z","size":44,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T11:07:17.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/mkht/DSCR_FileContent","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkht.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-19T14:06:43.000Z","updated_at":"2019-04-18T13:18:28.000Z","dependencies_parsed_at":"2022-09-07T15:41:58.809Z","dependency_job_id":null,"html_url":"https://github.com/mkht/DSCR_IniFile","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_IniFile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_IniFile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_IniFile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2FDSCR_IniFile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkht","download_url":"https://codeload.github.com/mkht/DSCR_IniFile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241382611,"owners_count":19953969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T01:18:36.433Z","updated_at":"2026-04-14T15:33:39.639Z","avatar_url":"https://github.com/mkht.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"DSCR_IniFile\n====\n\n## This repository is no longer maintained ! :no_entry:\nPlease use [DSCR_FileContent](https://github.com/mkht/DSCR_FileContent/) module.\n\n----\n[![Build status](https://ci.appveyor.com/api/projects/status/2i2u8q4jn9bwgmrd/branch/master?svg=true)](https://ci.appveyor.com/project/mkht/dscr-inifile/branch/master)\n[![codecov](https://codecov.io/gh/mkht/DSCR_IniFile/branch/master/graph/badge.svg)](https://codecov.io/gh/mkht/DSCR_IniFile)\n\nPowerShell DSC Resource to create INI file.\n\n## Install\nYou can install Resource from [PowerShell Gallery](https://www.powershellgallery.com/packages/DSCR_IniFile/).\n```Powershell\nInstall-Module -Name DSCR_IniFile\n```\n\n----\n## DSC Resources\n* **cIniFile**\nPowerShell DSC Resource to create ini file.\n\n## Properties\n### cIniFile\n+ [string] **Ensure** (Write):\n    + Specify the key exists or not.\n    + The default value is `Present`. (`Present` | `Absent`)\n\n+ [string] **Path** (Key):\n    + The path of the INI file.\n\n+ [string] **Key** (Key):\n    + Key element.\n    + If you specified key as empty string, cIniFile only check the section.\n\n+ [string] **Value** (Write):\n    + The value corresponding to the key.\n    + If this param not specified, will set empty string.\n\n+ [string] **Section** (Key):\n    + The section to which the key belongs.\n    + **If the key doesn't need to belong section, you should set the value for an empty string.**\n\n+ [string] **Encoding** (Write):\n    + You can choose text encoding for the INI file.\n    + `UTF8NoBOM` (default) / `UTF8BOM` / `utf32` / `unicode` / `bigendianunicode` / `ascii`\n\n+ [string] **NewLine** (Write):\n    + You can choose new line code for the INI file.\n    + `CRLF` (default) / `LF`\n\n\n## Examples\n+ **Example 1**: Sample configuration\n```Powershell\nConfiguration Example1 {\n    Import-DscResource -ModuleName DSCR_IniFile\n    cIniFile Apple {\n        Path = \"C:\\Test.ini\"\n        Section = \"\"\n        Key = \"Fruit_A\"\n        Value = \"Apple\"\n    }\n    cIniFile Banana {\n        Path = \"C:\\Test.ini\"\n        Section = \"\"\n        Key = \"Fruit_B\"\n        Value = \"Banana\"\n    }\n    cIniFile Ant {\n        Path = \"C:\\Test.ini\"\n        Section = \"Animals\"\n        Key = \"Animal_A\"\n        Value = \"Ant\"\n    }\n}\n```\n\nThe result of executing the above configuration, the following ini file will output to `C:\\Test.ini`\n```\nFruit_A=Apple\nFruit_B=Banana\n[Animals]\nAnimal_A=Ant\n```\n\n----\n## Functions\n\n### Get-IniFile\nLoad ini file and convert to the dictionary object\n\n+ **Syntax**\n```PowerShell\nGet-IniFile [-Path] \u003cstring\u003e [-Encoding { \u003cutf8\u003e | \u003cutf8BOM\u003e | \u003cutf32\u003e | \u003cunicode\u003e | \u003cbigendianunicode\u003e | \u003cascii\u003e | \u003cDefault\u003e }]\n```\n\n\n### ConvertTo-IniString\nConvert dictionary object to ini expression string\n\n+ **Syntax**\n```PowerShell\nConvertTo-IniString [-InputObject] \u003cSystem.Collections.Specialized.OrderedDictionary\u003e\n```\n\n+ **Example**\n```PowerShell\nPS\u003e $Dictionary = [ordered]@{ Section1 = @{ Key1 = 'Value1'; Key2 = 'Value2' } }\nPS\u003e ConvertTo-IniString -InputObject $Dictionary\n[Section1]\nKey1=Value1\nKey2=Value2\n```\n\n\n### Set-IniKey\nSet a key value pair to the dictionary\n\n+ **Syntax**\n```PowerShell\nSet-IniKey [-InputObject] \u003cSystem.Collections.Specialized.OrderedDictionary\u003e -Key \u003cstring\u003e [-Value \u003cstring\u003e] [-Section \u003cstring\u003e] [-PassThru]\n```\n\n+ **Example**\n```PowerShell\nPS\u003e $Dictionary = [ordered]@{ Section1 = @{ Key1 = 'Value1'; Key2 = 'Value2' } }\nPS\u003e $Dictionary | Set-IniKey -Key 'Key2' -Value 'ModValue2' -Section 'Section1' -PassThru | ConvertTo-IniString\n[Section1]\nKey1=Value1\nKey2=ModValue2\n```\n\n\n### Remove-IniKey\nRemove a key value pair from dictionary\n\n+ **Syntax**\n```PowerShell\nRemove-IniKey [-InputObject] \u003cSystem.Collections.Specialized.OrderedDictionary\u003e -Key \u003cstring\u003e [-Section \u003cstring\u003e] [-PassThru]\n```\n\n+ **Example**\n```PowerShell\nPS\u003e $Dictionary = [ordered]@{ Section1 = @{ Key1 = 'Value1'; Key2 = 'Value2' } }\nPS\u003e $Dictionary | Remove-IniKey -Key 'Key2' -Section 'Section1' -PassThru | ConvertTo-IniString\n[Section1]\nKey1=Value1\n```\n\n----\n## ChangeLog\n+ **3.1.0**\n    - Export useful functions (`Get-IniFile`, `ConvertTo-IniString`, `Set-IniKey`, `Remove-IniKey`)\n    - Fix typo in the module name\n\n+ **3.0.1**\n    - Fix PSSA issues (PSAvoidTrailingWhitespace)\n    - Remove unnecessary files in the published data\n\n+ **3.0.0**\n    - **[BREAKING CHANGE]** Default output encoding is changed from `UTF8BOM` to `UTF8NoBOM`\n\n+ **2.0.1**\n    - Fixed issue that an incorrect INI file has been created when the encoding other than `UTF8NoBOM` was specified.\n\n+ **2.0.0**\n    - Added **NewLine** property for specifying the new line code. (`CRLF` or `LF`)\n    - You can now specify `UTF8NoBOM` as Encoding.\n    - **[DEPRECATED]** Encoding options `UTF7` and `BigEndianUTF32` have been deprecated.\n\n+ **1.2.0**\n    - Check section only when `Key = \"\"` [#2](https://github.com/mkht/DSCR_IniFile/issues/2)\n\n+ **1.1.1**\n    - Fixed issue that does not work correctly when `Ensure = \"Absent\"` [#1](https://github.com/mkht/DSCR_IniFile/issues/1)\n    - `Value` param is no longer mandatory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkht%2Fdscr_inifile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkht%2Fdscr_inifile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkht%2Fdscr_inifile/lists"}