A
function Get-IniContent ($filePath) {
$ini = @{}
switch -Regex -File $filePath {
"^\[(.+)\]" {
$section = $matches[1]
$ini[$section] = @{}
$commentCount = 0
}
"^(;.*)$" {
$value = $matches[1]
$commentCount = $commentCount + 1
$name = "Comment" + $commentCount
$ini[$section][$name] = $value
}
"(.+?)\s*=(.*)" {
$name,$value = $matches[1..2]
$ini[$section][$name] = $value
}
}
return $ini
}