Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [QTIFW] ConsumeOutput on powershell ElevatedOperation not working

[QTIFW] ConsumeOutput on powershell ElevatedOperation not working

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
1 Posts 1 Posters 355 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    filipe7
    wrote on last edited by
    #1

    I am trying to create an installer for my Qt application using the Qt Installer Framework. When I attempt to use the following command with an installer without the option "Execute as an administrator":

    component.addElevatedOperation("ConsumeOutput", ["openSSHInstalled","powershell.exe", "& \"" +Dir.toNativeSeparator("@TargetDir@/scripts/installOpenSSHServer.ps1")+ "\""]);
    

    I encounter the following error in the console, and my script does not run:

    Warning: Cannot get any query output from executable "powershell.exe"
    

    This script installs the optional OpenSSHServer feature on Windows. Consequently, this script requires administrator rights. Therefore, I have set <RequiresAdminRights>true</RequiresAdminRights> in my XML file.

    When I use the same command but with the operation set to Execute, like this:

    component.addElevatedOperation("Execute", ["powershell.exe", "& \"" + Dir.toNativeSeparator("@TargetDir@/scripts/installOpenSSHServer.ps1") + "\""]);
    

    Everything runs correctly, and the OpenSSH server installation is successful. The issue is that with this command, I don't receive any feedback from the PowerShell script.

    I conducted a test by launching the installer as an administrator and with the command :

    component.addElevatedOperation("ConsumeOutput", ["openSSHInstalled","powershell.exe", "& \"" +Dir.toNativeSeparator("@TargetDir@/scripts/installOpenSSHServer.ps1")+ "\""]);
    

    and everything works fine. The problem is that I don't know how to enforce users to run it as an administrator, and I'm unsure if this is the correct solution. Do you have any ideas?

    I think there is an issue with the "ConsumeOutput" command that consistently performs a regular "Operation" instead of an "ElevatedOperation."

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved