How to handle Confirmation Popup Yes/No using power shell command

70 Views Asked by At

While downloading and installing the QZ Tray using powershell irm pwsh.sh | iex, after installation asking the Confirmation popup like Yes/No, how to handle this popup using powershell command

Please provide a solution

2

There are 2 best solutions below

4
MisterSmith On

Your best option is to use the silent / unattended installation option for your platform that would prevent the popup. You didnt provide enough details for me to give you an exact answer.

While its possible to interact with GUI components from powershell, it tends to be ugly messy code thats prone to break so i would advise against attempting that route.

0
tresf On

after installation asking the Confirmation popup like Yes/No

This Yes/No screen is not directly related to QZ Tray, but rather a UAC prompt that is provided by Windows when a command or program requiring elevated rights is being run. The QZ Tray installer requires elevated rights.

enter image description here

how to handle this popup using powershell command

This cannot be done. This pop-up is a deliberate security feature of Microsoft Windows.

However -- by manually starting PowerShell as administrator beforehand (which will suppress this popup -- or more accurately, move it to a different part of the workflow) the popup will no longer appear after pasting the command.


Addendum:

Future versions of QZ Tray may offer a user-mode install to avoid elevation, but at time of writing this, a user-mode installer is not available.

Since QZ Tray is open source, one may -- if they wish -- modify the installer to run as a normal user. This requires some advanced knowledge of the inner workings of how QZ Tray's installation works -- as well as knowledge of the NSIS installer format. At time of writing this, many QZ Tray installation steps can either be replaced with user-mode equivalents or will automatically fallback to user-mode equivalents and is entirely possible for someone familiar with/willing to modify and compile the source code.