views:

42

answers:

1

I am writing a script to automate an installation package. Annoyingly, there is no "silent" installation mode. (Actually it's "half silent" - it runs in the background and then pops up with a dialog box telling the user to reboot.)

I want to automate this, by detecting the dialog box has appeared and then either terminating the process and rebooting, or sending a keystroke to the dialog box.

Is this possible? I know you can do something like this to catch a process with a particular named window:

$fp = gps | where {$_.mainwindowtitle -match "You need to reboot your computer"}

but I don't know if this will work in this case.

Any suggestions gratefully received!

Thanks,

Ben

+2  A: 

@Jaykul wrote up a blog post and a snapin that provides some utilities to help with this - namely Get-Window.

Keith Hill