Revised: INI File #PowerShell Functions

  • 6

Revised: INI File #PowerShell Functions

Line Break

Author: Frank Peter (97 Articles)

Although alternatives are around for years now, I still stumble upon those old school INI files. Inspired by a small piece of code that I found recently at stackoverflow.com I have built a small PowerShell module that provides the following functions:

  • Import-Ini – read an INI file’s entire content into memory, structured as hashtable
  • Export-Ini – write the hashtable back to file
  • Remove-IniCategory – remove a category from an INI file
  • Remove-IniKey – remove a key from an INI file
  • Get-IniKey – return value of an INI file key
  • Set-IniKey – set a key in an INI file


6 Comments

Santiago Alejandro Agüero

July 31, 2012 at 7:03 pm

Great small library Frank! 🙂

webninja

February 22, 2016 at 4:00 pm

Code is messed up by HTML entities like &quote.

    Frank Peter

    February 22, 2016 at 5:26 pm

    I’ve revised the code

Raju

October 3, 2016 at 8:56 am

I want to update a value in the Ini file

Vincent SCOTTO

November 23, 2016 at 5:43 pm

It is exactly what I needed but that is not working for INI import. I get sections but no keys.

    Frank Peter

    November 25, 2016 at 12:30 am

    Thanks for the feedback. I fixed it in the code above.

Leave a Reply

*