Skip to content

PowerShell function that returns the contents of a given ini file as pscustomobject for further processing

Notifications You must be signed in to change notification settings

fpschultze/ConvertFrom-Ini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

ConvertFrom-Ini

PowerShell function that returns the contents of a given ini file as pscustomobjects for further processing (The function is based on ideas that I've found here: https://www.petri.com/managing-ini-files-with-powershell)

Usage is as simple as...

PS C:\> cat Get-Content $env:windir\win.ini
; for 16-bit app support
[fonts]
[extensions]
[mci extensions]
[files]
[Mail]
MAPI=1
CMCDLLNAME32=mapi32.dll
CMC=1
MAPIX=1
MAPIXVER=1.0.0.1
OLEMessaging=1
PS C:\> $ini = Get-Content $env:windir\win.ini | ConvertFrom-Ini
PS C:\> $ini.Mail

MAPI         : 1
CMCDLLNAME32 : mapi32.dll
CMC          : 1
MAPIX        : 1
MAPIXVER     : 1.0.0.1
OLEMessaging : 1

PS C:\>

About

PowerShell function that returns the contents of a given ini file as pscustomobject for further processing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published