I have created a few powershells scripts that work from a variables.ps1. This variables needs to be changed for every install. The script starts by running a simple COPYOUT.PS1. This PS1 copies from an ISO file and places the files on the C:\PSscript. Once all the files are on the system it opens the variables.ps1. This is when I can edit the PS1 and save it.
The issue is that I am not able to save it once it is open. This script needs to be the same name, because I copy the variables.ps1 to other servers that use it to install other software programs. Once I close the variables.ps1 it needs to finish the COPYOUT.PS1 by sending the updated variables.ps1 to the remote servers.
NOTEPAD "C:\PSscript\variables.ps1" | OUT-NULL
What can I do to get around this?
I have looked into:
(Start-Process notepad "C:\PSscript\variables.ps1" -PassThru).WaitForExit()
Hope that makes sense. Thank for you help.