Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Send "enter" signal in a PowerShell script to install window

So I've been testing with moving one of our install PowerShell logon scripts to PDQ Deploy. The problem is that the installer does not support any silent switches and requires the user to press "enter" twice. I've solved this with the following script that works when the computer boots up, but for some reason when I run the same script through PDQ Deploy it seems to hang when the first "Enter" is expected to be pressed.

Now I'm fairly sure the problem is the way PDQ executes the installer on the machine that is the issue, my question is, what do I need to modify so that the "Enter" signal is sent to the install window?

In the script we run a number of checks that work fine and define the $Executable variable.

---Script---

Invoke-Expression "& C:\Path-To\$Executable"

$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('ScriptDeployApp')
Sleep 10
$wshell.SendKeys('~')
Sleep 20
$wshell.SendKeys('~')

---End Script---

 

Any ideas/suggestions?

1

Comments

2 comments
Date Votes
  • Try changing the Run As setting (either at the package or step level) to "Deploy User (Interactive)".

    1
  • That pops up the installer window for the user that is logged in but does not proceed with the key strokes.

    1