PowerShell App.Config

Cross-referencing with this thread, which helped me with the same question:
Subsonic Access To App.Config Connection Strings From Referenced DLL in Powershell Script

I added the following to my script, before invoking the DLL that needs config settings, where $configpath is the location of the file I want to load:

[appdomain]::CurrentDomain.SetData("APP_CONFIG_FILE", $configpath)
Add-Type -AssemblyName System.Configuration

See this post to ensure the configuration file specified is applied to the running context.

Leave a Comment