$AssemblyRootPath = "c:\Temp\Nini-1.1.0\Nini\Bin\DotNet\2.0\Debug\2.0\Debug" $IniFile = "C:\temp\IniTest\Test.ini" $configSource = $null $extension = $null $filename = split-path $IniFile -leaf $extension = $filename.substring($filename.indexof("."), $filename.length-4) [System.Reflection.Assembly]::LoadFrom((join-Path $AssemblyRootPath -childPath NIni.dll)) | out-null switch ($extension) { ".ini" { $configSource = new-object Nini.Config.IniConfigSource($IniFile) break } ".config" { $configSource = new-object Nini.Config.DotNetConfigSource($IniFile) break } ".xml" { $configSource = new-object Nini.Config.XmlConfigSource($IniFile) break } default { $this.ThrowError("Unknown config file type") break } } $config = $configSource.AddConfig("SectionFromPowershell"); $config.Set("MyTestValue 1", $IniFile); $config.Set("MyTestValue 2", "Value 2"); $configSource.save($IniFile) $config = $configSource.AddConfig("AnotherIniSection"); $config.Set("Pair 1", "Values 1"); $config.Set("Pair 2", "Value 2"); $configSource.save($IniFile) $configSource