I want to search and replace a string in an xml file using PowerShell. I tried this:
(gc d:\test.xml).replace('1234','xxxx')|sc d:\test.xml
This works fine for my test.xml file. The content of my test.xml file is:
uehjduehduhfeuf xxxxxxxx hallo "1234"
But that file is only for testing. I want to edit a server.xml form my tomcat server in this way and if I'm using exactly the same command mentioned obove I get this error message:
Method invocation failed because [System.Object[]] doesn't contain a method named 'replace'.
Does anybody know what's the problem?