https://github.com/lipkau/PsIni
Work with INI files in PowerShell using hashtables
https://github.com/lipkau/PsIni
Last synced: 3 months 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: 2024-06-17T09:16:27.000Z (8 months ago)
- Last Synced: 2024-06-17T10:41:47.593Z (8 months ago)
- Language: PowerShell
- Homepage: http://lipkau.github.io/PsIni
- Size: 224 KB
- Stars: 149
- Watchers: 14
- Forks: 49
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - lipkau/PsIni - Work with INI files in PowerShell using hashtables (PowerShell)
README
# [PsIni](http://lipkau.github.io/PsIni/)
[](https://github.com/lipkau/PsIni/releases/latest)
[](https://ci.appveyor.com/project/lipkau/psini/branch/master)
[](https://www.powershellgallery.com/packages/PsIni)
## Table of Contents
* [Description](#description)
* [Installation](#installation)
* [Examples](#examples)
* [Authors/Contributors](#authorscontributors)## 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)## Installation
PsIni is published to the [Powershell Gallery](https://www.powershellgallery.com/packages/PsIni)
and can be installed as follows:```powershell
Install-Module PsIni
```## Examples
Create a hashtable and save it to C:\settings.ini:
```powershell
Import-Module PsIni
$Category1 = @{"Key1"="Value1";"Key2"="Value2"}
$Category2 = @{"Key1"="Value1";"Key2"="Value2"}
$NewINIContent = @{"Category1"=$Category1;"Category2"=$Category2}
Out-IniFile -InputObject $NewINIContent -FilePath "C:\settings.ini"
```Results:
> ```Ini
> [Category1]
> Key1=Value1
> Key2=Value2
>
> [Category2]
> Key1=Value1
> Key2=Value2
> ```Returns the key "Key2" of the section "Category2" from the C:\settings.ini file:
```powershell
$FileContent = Get-IniContent "C:\settings.ini"
$FileContent["Category2"]["Key2"]
```## Authors/Contributors
### Author
* [Oliver Lipkau](https://github.com/lipkau)
### Contributor
* [Craig Buchanan](https://github.com/craibuc)
* [Colin Bate](https://github.com/colinbate)
* [Sean Seymour](https://github.com/seanjseymour)
* [Alexis Côté](https://github.com/popojargo)
* [Konstantin Heil](https://github.com/heilkn)
* [SeverinLeonhardt](https://github.com/SeverinLeonhardt)
* [davidhayesbc](https://github.com/davidhayesbc)