Relative Content

Tag Archive for powershell

How can I add line of text at a specific line Number in a text file?

I have the following Powershell script to search a string pattern in all files in a folder. If the pattern does not exist then it adds the string as expected but at the end of the file. I would like to add the string to a specific line number after line 106. This is the same for all .CONFIG files in the folder.
How can I add this to my existing script as I have tried