0

A WinForms program I have developed prints fine and as expected when run as an interactive user. Using the same account but as a scheduled task, the process will run correctly however it prints part of the output in the incorrect font.

The program is a label printer that prints updated pricing labels. It has an option (-s) that the Task Scheduler calls which does not present the GUI but does an update and prints. Executing this as an interactive user through run works correctly (i.e. the correct font is used).

Any clues as to what's happening here? The font that isn't printing correctly is a non-standard system font.

This runs on a server and I thought it might be due to printer redirection but I did a console logon and it worked fine as an interactive process on the console just as it does as interactive through remote desktop.

Sam
  • 4,219
  • 7
  • 52
  • 80

2 Answers2

0

I had a very similar issue to yours (running an application through a scheduled task would use the default font but when running locally it would find the custom font I installed) and I found a solution; On Server 2008, there is an issue where custom fonts are not registered immediately after installing for non-interactive users, whereas regular users (i.e. when running on a user actually logged in to the machine) do have the font registered immediately.

The solution that worked for me was to simply restart the machine the font was installed on and the font started working under the non-interactive accounts, as when the computer is turned on it registers correctly. It appears the font installation has a bug where it doesn't register the font correctly for non-interactive users until a reboot.

chillNZ
  • 99
  • 1
  • 10
0

Interesting problem. Presumably, Windows doesn't load fonts into the non-interactive logon sessions in order to conserve resources.

See this answer for one approach, using the ps tool to create an interactive session when running the task.

Community
  • 1
  • 1
Steven P
  • 1,956
  • 1
  • 16
  • 17