Jump to content
Tralveller

GUI compiled application will not shown when started as "Scheduled task" with SYSTEM account

Recommended Posts

Tralveller

Hello at all,

 

I try to start a compiled GUI application during an installation that runs as local "SYSTEM" account.

On normal use it works and the GUI comes up.

Then I'm creating in Scheduled tasks a new task which runs as "NT SYSTEM" account, the applications starts, but no GUI will shown on current logged on user.

Here an example of my code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=C:\temp\favicon.ico
#AutoIt3Wrapper_Outfile=C:\temp\User_Wait_Message_x32.exe
#AutoIt3Wrapper_Outfile_x64=C:\temp\User_Wait_Message_x64.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Info_Encryption()

Func Info_Encryption()
    Local $widthCell, $msg, $iOldOpt

    GUICreate("Test...", 655, 475, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU), $WS_EX_TOPMOST) ; alternativ zu $WS_CAPTION auch $WS_MINIMIZEBOX

    SoundPlay(@WindowsDir & "\media\Windows Balloon.wav", 1)

    $iOldOpt = Opt("GUICoordMode", 2)

    $widthCell = 800 ; GUICtrlCreateLabel maximale Länge vom textfeld
    $font = "Verdana" ; Schriftart definiert
    GUISetFont(12, 800, $font) ; Schrift-Größe, Dicke und Art aktiviert
    GUICtrlCreateLabel("Test1", 20, 20, $widthCell)
    GUICtrlCreateLabel("''Test2''.", -1, 0, $widthCell)
    GUICtrlCreateLabel("Test3", -1, 0, $widthCell)
    GUICtrlCreateLabel("Test4", -1, 0, $widthCell)

    $cDummy = GUICtrlCreateDummy()
    Local $aAcc[1][2] = [["^{NUMPADMULT}", $cDummy]]
    GUISetAccelerators($aAcc)

    GUISetState() ; Zeigt eine leere Dialogbox an

    TraySetToolTip ("Test...")
    TrayTip ("Line 1", "Line 2", 15, 1)
    AutoItSetOption ("TrayMenuMode", 1)


    Do
        Until GUIGetMsg() = $cDummy
            Exit



    ;GUI starten, bis der Dialog beendet wird
    ;Ohne verhindern von Schließen via ALT + F4 bzw. STRG + PAUSE
    ;Do
    ;    $msg = GUIGetMsg()
    ;Until $msg = $GUI_EVENT_CLOSE

    $iOldOpt = Opt("GUICoordMode", $iOldOpt)
EndFunc   ;==>Example

 

How can I show the GUI by using Windows SYSTEM account?

 

Thanks a lot

Kind regards

Tralveller

Share this post


Link to post
Share on other sites
BigDaddyO

can't, the SYSTEM account does not have access to the desktop.  if you want to see it, it has to be launched as the user.

 

  • Like 1

hmm... I guess I have to have a signature...

Share this post


Link to post
Share on other sites
Tralveller

Hello,

Thanks at all for feedback.
Sorry for late reply.

@BigDaddyO Yes, that's correct.

I resolved that problem by importing and starting a Scheduled Task and defined as user "predefined\Users", after that I delete directly the task => the message box still running.
If a User is logged on, it is also member of this group and in facts the user gets the message box. And if no one is logged on I don't care about that :)
Group ID of "predefined\Users" is: S-1-5-32-545
More information about groups:
https://support.microsoft.com/en-gb/help/243330/well-known-security-identifiers-in-windows-operating-systems

A Sample of a scheduled Task I've attached.
Import/Create task: SCHTASKS /CREATE /XML Scheduled_Task_Config.xml /TN "GUI_Application.exe" 2>&1
Start task: SCHTASKS /RUN /TN "GUI_Application.exe" 2>&1
Wait 5 seconds: PING 127.0.0.1 -n 6 >NUL 2>NUL
Delete task: SCHTASKS /DELETE /TN "GUI_Application.exe" 2>&1

If GUI Application is not required any more (e.g. installation finished), simply kill the application with all its sub-processes.
TASKKILL /IM "GUI_Application.exe" /T /F 2>&1

Maybe this is helpful for one or other :)

Kind regards
Tralveller

Scheduled_Task_Config.xml

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×