0

I'd like to create a Powershell script to press the next button in an installation wizard.

I'm troubleshooting a script that a client wrote to help them automate the process of installing software. This script can allegedly fully install any program (with some small amount of customization from program to program).

Now I've gotten it to work to a point where it launches the install wizard, but then nothing happens. Their problem only happens further down the install process, but I can't seem to figure out why the first part of it being able to press next doesn't work.

I can provide code if necessary.

What line of code I should look for in the script that could make the script push the "next" and/or "continue" buttons?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
T. Aalbaek
  • 23
  • 2
  • 10
  • 1
    Is the installer a standard one? Have you looked into [msiexec](https://learn.microsoft.com/en-us/windows/desktop/msi/command-line-options)? – thordarson Aug 24 '18 at 12:43
  • @thordarson the installer is fairly standard, though it has one aspect that I haven't seen in an installer before. In the beginning it pops up and asks what language you would like to use, but not with a drop down menu like normal, it's not a normal install wizard right there, but then another window opens up that seems to be a completely standard wizard. – T. Aalbaek Aug 24 '18 at 13:46
  • Normally this is referred to as a "silent" install. A good installer should support a silent mode (no user interaction). Properly designed MSI packages support this. You need to ask whoever designed the installer. This is not really a programming question but rather a "how do I silently install a software package" question (more appropriate for superuser.com). – Bill_Stewart Aug 24 '18 at 13:59
  • Could maybe integrate the powershell script to call autohotkey???? Out there idea I know but if needs must.... https://autohotkey.com/ – Jorg Roper Aug 24 '18 at 14:17

1 Answers1

1

Can you? Probably.

Powershell has access to .Net API and even native Windows API, so you could go low-level enough to enumerate windows in the installer window, find the window labeled 'Next' and send a pair of mouseDown, mouseUp events to the button.

Should you? Probably not.

As mentioned in comments, any good installer system supports some method of installing silently. MSI, if I recall correctly, has a way of recording manual steps performed by a user and store them in a Response File. Then you may pass the .rsp file in later executions of the installer.

See other answers: How to make better use of msi files

veefu
  • 2,820
  • 1
  • 19
  • 29