https://github.com/lipkau/psini
Work with INI files in PowerShell using hashtables
https://github.com/lipkau/psini
ini powershell powershell-module
Last synced: 26 days ago
JSON representation
Work with INI files in PowerShell using hashtables
- Host: GitHub
- URL: https://github.com/lipkau/psini
- Owner: lipkau
- License: mit
- Created: 2013-05-07T13:31:54.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2025-04-04T17:35:24.000Z (about 1 month ago)
- Last Synced: 2025-04-05T10:35:50.124Z (about 1 month ago)
- Topics: ini, powershell, powershell-module
- Language: PowerShell
- Homepage: http://lipkau.github.io/PsIni
- Size: 254 KB
- Stars: 153
- Watchers: 9
- Forks: 52
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# [PSIni](http://lipkau.github.io/PSIni/)
[](https://github.com/lipkau/PSIni/releases/latest)

[](https://www.powershellgallery.com/packages/PSIni)
## Table of Contents
- [PSIni](#psini)
- [Table of Contents](#table-of-contents)
- [Description](#description)
- [Origin](#origin)
- [Installation](#installation)
- [Examples](#examples)
- [Create INI file from hashtable](#create-ini-file-from-hashtable)
- [Read the content of an INI file](#read-the-content-of-an-ini-file)
- [Contributors](#contributors)## Description
Work with INI files in PowerShell using hashtables.
### Origin
This code was originally a blog post for [Hey Scripting Guy](http://blogs.technet.com/b/heyscriptingguy).
> [Use PowerShell to Work with Any INI File](http://blogs.technet.com/b/heyscriptingguy/archive/2011/08/20/use-powershell-to-work-with-any-ini-file.aspx)Over time this project got a lot of enhancements and major face-lifts.
## Installation
PSIni is published to the [Powershell Gallery](https://www.powershellgallery.com/packages/PSIni)
and can be installed as follows:```powershell
Install-Module PSIni <# -Scope User #>
```---
When using the source (this repository), you can easily get the necessary setup by running
```powershell
. ./tools/setup.ps1
```_Additional information can be found in [CONTRIBUTING](CONTRIBUTING.md)._
## Examples
### Create INI file from hashtable
Create a hashtable and save it to `./settings.ini`:
```powershell
$Category1 = @{"Key1"="Value1";"Key2"="Value2"}
$Category2 = @{"Key1"="Value1";"Key2"="Value2"}
$NewINIContent = @{"Category1"=$Category1;"Category2"=$Category2}Import-Module PSIni
Out-IniFile -InputObject $NewINIContent -FilePath ".\settings.ini"
```Results:
> ```Ini
> [Category1]
> Key1=Value1
> Key2=Value2
>
> [Category2]
> Key1=Value1
> Key2=Value2
> ```### Read the content of an INI file
Returns the key "Key2" of the section "Category2" from the `./settings.ini` file:
```powershell
$FileContent = Get-IniContent "C:\settings.ini"
$FileContent["Category2"]["Key2"]
```## Contributors
This project benefited immensely from the contribution of powershell enthusiasts.
Thank you ❤️The Contributors: