Add node to XML file
#write to owstimer.exe.config
$content='<!--<add key="GBPSubsite" value="sites/test"/>-->
<add key="GBPSubsite" value="gbp/portal" />
<!--<add key="MatMasExtendedLogging" value="true"/>-->
<add key="MatMasExtendedLogging" value="false" />'
$FilePath="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\OWSTIMER.EXE.CONFIG"
$xml=[xml](get-content $FilePath)
$node=$xml.selectSingleNode("/configuration/appSettings")
#if appSettings node doesn't exist, create it
if($node -eq $null)
{
#$node=$xml.selectSingleNode("/configuration")
$newNode=$xml.CreateElement("appSettings")
$xml["configuration"].appendchild($newNode)
$node=$xml.selectSingleNode("/configuration/appSettings")
}
#write content to appSettings node
$node.set_InnerXml($content)
$xml.Save($FilePath)