Function Get-INIValue { # $ini is the name of the ini fle # $section is the name of the section head like [Mail] # Specify the name without the brackets # $prop is the property you want under the section # sample usage: $from=Get-inivalue myapp.ini mail from Param ([string]$ini,[string]$section,[string]$prop) #get the line number to start searching from $LineNum=(Get-Content myapp.ini | Select-String “\[$section\]”).Linenumber $limit=(Get-Content myapp.ini).length #total number of lines in the ini fle for ($i=$LineNum;$i -le $limit;$i++) { $line=(Get-Content myapp.ini)[$i] if ($line -match $prop+”=”) { $value=($line.split(“=”))[1] return $value Break } } return “NotFound” }