I want the second username string to be replaced by a string read from the CSV file under usernames ... Note the first username has a dash in front of it and it should stay as it is -username, I need just the second username to be changed.
To clarify - there is one parameter (literal string) "-username" and a uersname (which is different on each PC). The non-literal username needs to be replaced.
I cannot see it on mobile: Is the CSV file tab delimited?
Everything but the username stays the same? Because it is much more simple to just write a string to remote than to replace a value.
I do not think you need csv and txt files at the same time
CSV already has computer name that the script will access and the username that will be changed.
example : the script will access Comp1 and changethe second "username" string to John ..