silent chain installation

Nikolay Karetnikov 21 Reputation points
2022-12-24T12:17:29.057+00:00

Hello!
I envision a ps1 script that would simply run an .exe file in a silent installation mode and as soon as the silent installation finishes replace a couple of files in a target directory
Would someone please share with me what would be a good start to learn more on how it can be achieved?

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. TechLife 246 Reputation points
    2022-12-26T16:36:46.94+00:00

    I would look to use start-process with the wait parameter to complete the install.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.3

    You'll need a way to verify the install completed successful. If you were installing via msi you could use get-eventlog or wmi class win32_product for this.

    Then, you could use copy-item to add the files you need. Use -force parameter as needed. You may run into a problem if the file is still locked after install.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/copy-item?view=powershell-7.3

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2022-12-24T15:48:28.207+00:00

    Start by downloading this free PDF (Windows-PowerShell-4). Read all the chapters in the 1st half of the book (in sequence!) and do the exercises. When you feel comfortable with your understanding of PowerShell, read the 2nd half of the book and the exercises in each chapter.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.