Page 1 of 1

how to replace text in files located on remote servers ?

Posted: 02 Apr 2021 07:06
by jmclej
Hello,
I need to replace all the occurrences of the text "http:\\toto.com\" to "http:\\toto-preprod.com\" in a list of files that I know but that are located on different remote servers.

server1 : C:\arbo1\...\file.config
server1 : C:\arbo2\...\file.config
server1 : C:\arbo3\...\file.config
server2 : C:\arbo4\...\file.config
server2 : C:\arbo1\...\file.config

I guess finding a replace function is easy but I have no idea how to connect to remote servers via a script (dos or powershell). For each server, the scriptg needs to ask for the credentials.
If it is not possible in a batch, I am OK for a C# solution.
Thanks