I am using the XML capabilities of powershell to modify a .config file. Calling XMLDocument.Save doesn't have any effect, unless I supply the complete path name.
# Open the xml file
$config = [xml](get-content web.config)
#
# modify the XML
$config.SelectNodes("./configuration/connectionStrings/add[@name='LocalSqlServer']") | % { $connNode = $_ }
$connNode.connectionString = $connNode.connectionString -replace '^(.*)Server=[^;]+(.*)$', '$1Server=192.168.5.2$2'
#
#
# Now I save it again
#
# This doesn't save it!
$config.Save("web.config");
# However, this works
$config.Save("{0}\\web.config" -f (get-location));
Why doesn't $config.Save("web.config") work?
Did I end up saving it somewhere else, other than my local directory?