コメントに基づいて更新します。
$xml = [xml]'<configuration>
<appSettings>
<add key="filepath" value="D:\Data" />
<add key="filename" value="test.log" />
</appSettings>
</configuration>'
$xml.configuration.appSettings.add | foreach { if ($_.key -eq 'filepath') { $_.value = "C:\Data" } }
$xml.Save("C:\dell\NewApp.config")
================================================== =========================================
古い答え
$xml = [xml]'<configuration>
<appSettings>
<add key="filepath" value="D:\Data" />
</appSettings>
</configuration>'
$xml.configuration.appSettings.add.value = "C:\Data"
$xml.Save("NewApp.config")
また
$xml = [xml](Get-Content App.config)
$xml.configuration.appSettings.add.value = "C:\Data"
$xml.Save("NewApp.Config")