1
I'm currently trying to script the installation of Microsoft Sql Server 2012, and I've run into a problem with letting the user set options for the installation process in my powershell script
Because sql server's options are set in an .ini file, I'm not sure what the best way to edit said .ini file is. I could see myself
- Copying the whole .ini file in powershell and setting variables within the quotes to write it out later, or
- saving the ini file separately and searching for each line I need to set variables as a string to edit separately.
Is there any more elegant way to work with .ini files than this? Is there any "find and replace" powershell module for files that I could use?
Probably best to re-write the entire .ini file from an "in-script" variable that contains your template because then you can guarantee that the content will be what you need it to be (plus the values the user sets)... – Kinnectus – 2017-07-28T15:09:23.590
"Is there any "find and replace" PowerShell module for files that I could use?" INI files are just text, any of PS's standard find and replace commands would work on one. Load the file into memory, find and replace, dump back to file. – Ƭᴇcʜιᴇ007 – 2017-07-28T15:52:18.067