I don't think it is easy to automate (script) the vi editor, which is a full-screen editor.
But sed, which is a line editor, should be a lot easier to automate.
An alternative could be to copy over the file to your station from within the script (SCP), do the changes in PowerShell, and then copy the file back.