WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Franais)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Print not working when run as service. (Read 2369 times)
RSC
YaBB Newbies
*
Offline



Posts: 12
Print not working when run as service.
Jan 3rd, 2017 at 6:01pm
 
Ive created a task to monitor a folder and print any incoming word documents. Once the document has been printed, its moved to a done folder.

This all works perfectly when I run the task manually, but for some reason, it does not work when run as a service (Im running it as the local system account, and Im not accessing any network resources). The file seems to be found correctly, but its not printed before its moved. Not sure if this is a permission thing with the service and MS Word, so I did try changing the sign on account for the service to the computer admin, but that didnt help.

I contacted support a couple of weeks ago, but I guess with the holiday season they're slower to respond.

Any suggestions?
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Print not working when run as service.
Reply #1 - Jan 3rd, 2017 at 6:53pm
 
Hi,

When you run as a service the printer may not be available to the LocalSystem user. Please read http://blog-en.gdpsoftware.com/2010/04/watchdirectory-tasks-as-windows-service.h...

If you set the service to run as "you" it should be fine. Some people reported they also needed to check the option to "allow service to interact with the desktop" but first try without that.

I looked for your email but couldn't find it, sorry.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #2 - Jan 3rd, 2017 at 7:29pm
 
Thanks for the reply.

Gert wrote on Jan 3rd, 2017 at 6:53pm:
When you run as a service the printer may not be available to the LocalSystem user. Please read http://blog-en.gdpsoftware.com/2010/04/watchdirectory-tasks-as-windows-service.h...

If you set the service to run as "you" it should be fine.


I thought this might be the issue, but changing users didn't do anything for me.

Gert wrote on Jan 3rd, 2017 at 6:53pm:
Some people reported they also needed to check the option to "allow service to interact with the desktop" but first try without that.


Tried it both ways with no luck.

Gert wrote on Jan 3rd, 2017 at 6:53pm:
I looked for your email but couldn't find it, sorry.


Here's the subject line that was generated automatically if it helps to find the ticket. I did attach logs and the batch file to the ticket, so that may have more useful info.
watchDirectory - Ticket: Friday, 23-Dec-2016 15:47:45 GMT

Any other ideas?
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #3 - Jan 3rd, 2017 at 8:05pm
 
Which OS and what kind of printer do you use (local or network shared)?
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #4 - Jan 3rd, 2017 at 8:15pm
 
Dirk wrote on Jan 3rd, 2017 at 8:05pm:
Which OS and what kind of printer do you use (local or network shared)?


Windows 8.1, and it's a local printer (it's the adobe pdf printer driver).
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #5 - Jan 3rd, 2017 at 8:49pm
 
ok, please set the service to 'local system' and 'interact with desktop' and check HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveService
s
Set its value to 0 . Note that different windows versions need different settings at this place.

Try again.
If it is still not printing check windows event log 'Application' and 'System' for usefull entries.
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #6 - Jan 3rd, 2017 at 9:28pm
 
Dirk wrote on Jan 3rd, 2017 at 8:49pm:
ok, please set the service to 'local system' and 'interact with desktop' and check HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveService
s
Set its value to 0 . Note that different windows versions need different settings at this place.

Note that in both cases the file gets moved successfully, just no print on the second one.

Try again.
If it is still not printing check windows event log 'Application' and 'System' for usefull entries.


Have done this and no luck. It did not print the job. I looked in the event log and saw a message from a few hours ago

"The watchDirectory:PrintWord service is marked as an interactive service. However, the system is configured to not allow interactive services. This service may not function properly."

I'm not getting this (or any) error messages now that I have changed the registry setting.

Don't know if this is any help, but here's the log from a successful run (run manually)

2017-01-03 15:24:30.000;FN;X:Input\in\sample.docx;;
2017-01-03 15:24:43.000;I; done ;;
2017-01-03 15:24:44.000;I;File X:\Input\in\~$sample.docx does not exist anymore, event removed;;

And a failed run (run as a service)
2017-01-03 15:14:40.000;FN;X:\Input\in\sample.docx;;
2017-01-03 15:15:51.000;I; done ;;

Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #7 - Jan 3rd, 2017 at 9:34pm
 
ok, the registry settings you did prevent the event log error to reappear.

Is X: a local or a network drive?
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #8 - Jan 3rd, 2017 at 9:39pm
 
x: is a local hard drive
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #9 - Jan 3rd, 2017 at 9:43pm
 
can you please post the log entry from the try as service after you did the registry change?
Also please check that the user 'local system' has full access (read and write!) to X: and subfolders.
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #10 - Jan 3rd, 2017 at 9:50pm
 
The last log entry I posted was a failed run as service

2017-01-03 15:14:40.000;FN;X:\Input\in\sample.docx;;
2017-01-03 15:15:51.000;I; done ;;

I'm fairly certain it has full permissions on the drive in question, but not sure where that is checked in 8.1

Whenever I run the task manually, I can actually see MS Word open up and the print dialog box, and then word shuts down. When I run as service I never actually see MS Word at all. Should I?
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #11 - Jan 3rd, 2017 at 10:13pm
 
but the time stamp of this log entry is before the one you run manually. Note that when you change the task to run manually and change back to 'as service' you change the service settings back to default. In default 'interact' with desktop' is not checked!

Check permissions:
right click x: and/or the folder your docx was saved and chose 'properties', than tab 'security' A user called 'local system' needs 'full access'.
In the log from manual run I see word is writing his temp file for open docs (~...). In the other one not, so maybe 'local system' has no right to write this temp file.

I sm not sure but I would say word should open when run as service.

I will do some tests tomorrow (its late here in Europe) and come back to you.
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #12 - Jan 4th, 2017 at 12:27am
 
I let the service one run first and got the log and then ran manually to get  a working log.

However, here's another one

2017-01-03 18:22:22.000;FN;X:\Input\in\sample.docx;;
2017-01-03 18:23:33.000;I;     done ;;

The security is good. I also tried changing the dcomcnfg settings to change the identity to myself (no luck) or interactive user (no luck).

Thanks for the help, I'll look back tomorrow.
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #13 - Jan 4th, 2017 at 10:06am
 
I did some test on my W10.
First I was able to reproduce the exact behavior you see, including the event log entry.

Finally I got it to work with Adobe printer and Word 2013.

- make sure the registry key is set to 0 decimal: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveService

- go to services (services.msc), stop the service and change the user under which the service is running to the username where the task was running fine when started manually. Enter his password. Keep this in mind when you change the password for this user. I tried with a local user, so it looks like: ".\Dirk" as username.
- make sure that this user has full access to the watched folder and the destination folder of your pdf (if configured a different folder in Adobe PDF printer settings)
- make sure that there is no existing pdf file with the same name as your docx in the folder Adobe PDF printer will save. Otherwise Adobe could not overwride (because its in opened, in use)

With this settings it works for me under Windows 10. I do not expect a different behavior with Windows 8.1. I do not see an opening Word when run as service.

In one of your posts you wrote that the .docx was moved away successfully. How did you do that? I assume with a second task as the word printing task does not support to move the file. If so, please stop this task. I could be that this second task moved to file away before word took it.

If it works as described above please let me know, I than will show you a way to move the file after printing.




Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #14 - Jan 4th, 2017 at 4:16pm
 
Dirk wrote on Jan 4th, 2017 at 10:06am:
I did some test on my W10.
First I was able to reproduce the exact behavior you see, including the event log entry.

Finally I got it to work with Adobe printer and Word 2013.

- make sure the registry key is set to 0 decimal: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveService

- go to services (services.msc), stop the service and change the user under which the service is running to the username where the task was running fine when started manually. Enter his password. Keep this in mind when you change the password for this user. I tried with a local user, so it looks like: ".\Dirk" as username.
- make sure that this user has full access to the watched folder and the destination folder of your pdf (if configured a different folder in Adobe PDF printer settings)
- make sure that there is no existing pdf file with the same name as your docx in the folder Adobe PDF printer will save. Otherwise Adobe could not overwride (because its in opened, in use)

With this settings it works for me under Windows 10. I do not expect a different behavior with Windows 8.1. I do not see an opening Word when run as service.



Still no luck for meafter making those changes Sad.

Dirk wrote on Jan 4th, 2017 at 10:06am:
In one of your posts you wrote that the .docx was moved away successfully. How did you do that? I assume with a second task as the word printing task does not support to move the file.


I was shown a way to move the file by one of the other admins. I modified the batch file for the print job to move it after it is done.
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #15 - Jan 4th, 2017 at 4:48pm
 
When you move the file inside the script at its very end, just before 'annotate'-line it is ok.

are you using a local account for the service user or a domain account?
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #16 - Jan 4th, 2017 at 4:54pm
 
and can you please use a normal printer as standard just for a test.
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
RSC
YaBB Newbies
*
Offline



Posts: 12
Re: Print not working when run as service.
Reply #17 - Jan 4th, 2017 at 5:10pm
 
Dirk wrote on Jan 4th, 2017 at 4:48pm:
are you using a local account for the service user or a domain account?


I'm using a local account. Just .\name

I've tried using my default windows printer, no output.


Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: Print not working when run as service.
Reply #18 - Jan 4th, 2017 at 5:26pm
 
and .\name is the account that works manually, right?

I am getting out of ideas.

If you like you can send me screenshots from all settings we discussed, maybe I see an error. Do not post them here, send it by mail, see footer for my address.
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
Page Index Toggle Pages: 1