I have a script, written in Python, that generates a PDF document and prints it to network printer. When I execute that script through the cmd line or launch executable
.cmd
or.bat
file, it works nicely and prints document.However, when I put that script to be launched via Task Scheduler, it shows that it has succeeded and task completed with no errors thrown. I tried to put that code in
try/except
frame to see if any errors are shown but I still do not see any of them.I went into ‘Devices and Printers’ found my network printer and added a user which is used in Task Scheduler when running the task but no documents were printed.
I found same printer in
regedit
underHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers
and also added same user which is used to run that task but it was fruitless.Does anyone have any other solutions how I can print documents using Task Scheduler?
Answer
If permissions are ok, then probably the network printer is not correctly configured in Windows for the user account which is used to run the script; try logging on to the computer using that user account, manually adding the network printer and setting it as the default printer: this should make sure everything is configured correctly.
Also, while you are logged in as that user account, print something; if there are other issues preventing that user from printing, they will become immediately apparent.
Attribution
Source : Link , Question Author : orangutangas , Answer Author : Massimo