SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have some web parts deployed in our Sites, which are not working due to Migration from MOSS to SPS2010, and I need to replace the namespace used by power shell by accessing the Webpart's XML..

share|improve this question
If the answer solved the problem statet in your question, you should mark this answer as accepted answer to help future visitors. – Benny Skogberg Jan 9 '14 at 11:18

Try something like this:

$xml = [xml](get-content file.xml)
$xml  = $xml.OuterXml.Replace("xmlns=`"whatever`"", "xmlns=`"new`"")
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.