Page 1 of 1

start GUI program from non-interactive session

Posted: 12 May 2022 03:24
by lazna
Have set of batch scripts powered CGI based web system, web server running under SYSTEM account. As result of one script, physical document should be printed. Because of document layout, I choosed program https://github.com/kendallb/PrintHtml for printing, it starting fom console with parameters.

There is a problem the PrintHTML is not a console program as its author state: "Unfortunately this program is not a console program, as it needs access to Windows UI components in order to print."

Is it possible to start such program (only start with parameters, no need any response from it) from non-interactive session? Playing with PSEXEC option -i but have no luck. Also thinking about to create Schedule task and start it by "schtasks /run" but not tested yet.

System is running on W7/32bit with specific user autologon on startup.

Any ideas?

Re: start GUI program from non-interactive session

Posted: 15 May 2022 16:51
by lazna
SOLVED:

Create Scheduled task and start it via 'schtasks /RUN' solve this isssue.

Re: start GUI program from non-interactive session

Posted: 16 May 2022 03:47
by aGerman
Thanks for the update. I haven't had any good idea since manyfold things can prevent you to get this working.

Just a side note if you want to tell the developer - every GUI process can attach the console window of the parent process in order to make it a console program, too. I find it a bad design if the tool is controlled via command line, but it doesn't report back to the command line interface. This makes automation rather obscure.

Steffen

Re: start GUI program from non-interactive session

Posted: 16 May 2022 06:40
by lazna
Already solve monitoring of started printing task:

As anything else do not acccess printer on this machine but my script, processing output of following command

Code: Select all

powershell.exe "Get-WinEvent -MaxEvents 4 -FilterHashTable @{ LogName = 'Microsoft-Windows-PrintService/Operational'; ID = 800,801,805,307} | Select-Object -Property TimeCreated,Message | ft -HideTableHeader | Out-String -width 999"
to monitor printing task as next step in my script.

Re: start GUI program from non-interactive session

Posted: 22 May 2022 09:02
by Andrew92
lazna wrote:
12 May 2022 03:24
Have set of batch scripts powered CGI based web system, web server running under SYSTEM account. As result of one script, physical document should be printed. Because of document layout, I choosed program https://github.com/kendallb/PrintHtml for printing, it starting fom console with parameters.

There is a problem the PrintHTML is not a console program as its author state: "Unfortunately this program is not a console program, as it needs access to Windows UI components in order to print."

Is it possible to start such program (only start with parameters, no need any response from it) from non-interactive session? Playing with PSEXEC option -i but have no luck. Also thinking about to create Schedule task and start it by "schtasks /run" but not tested yet.

System is running on W7/32bit with specific user autologon on startup.

Any ideas?
Hey, This link doesnt seem to be working. Just wondering if its a problem on my end?

Re: start GUI program from non-interactive session

Posted: 22 May 2022 09:57
by aGerman
It's a peculiarity of this forum that external links are only accessible if you open them in a new tab or window.

Steffen

Re: start GUI program from non-interactive session

Posted: 25 May 2022 07:27
by Andrew92
Ah yes, it worked now. I'm not sure why that is though? Never seen anything like it before.