 [xml]$webXML = Get-Content "C:\Deployment\ABCfolder\web.config" $mainXML = $WebXml.configuration."system.webServer".httpRedirect $mainXML.destination -replace "\w.*","http://localhost/ABCname" $mainXML.Save($webXML)  