What happens at logon
  1. 01

    Logon or reconnect

    The scheduled task “\WePrintEasy\WePrintEasy Agent” starts the agent invisibly as the user.

  2. 02

    Read configuration

    The agent reads config.json and determines the assignment: user → group with smallest priority → none.

  3. 03

    Prepare

    “Let Windows manage my default printer” off; connect a missing network printer.

  4. 04

    Logon phase

    Every 3 s for 120 s: compare the default printer with the assignment and reset it if needed.

  5. 05

    Session monitoring

    Optional: check every 30 s for the whole session; configuration changes are picked up automatically.

Loop until the session ends

The scheduled task

The installer registers the task \WePrintEasy\WePrintEasy Agent with two triggers: at logon and on reconnect of a remote session – reconnecting brings new client printers into the session. The task runs for the built-in Users group with limited rights, one instance per logon, without a time limit.

The agent window is hidden. From Windows Server 2022 (build 20348) the task starts it via conhost --headless, so not even a console window flashes up.

One agent per session

At most one agent instance runs per session. When the task fires again – for example after a reconnect – the new call wakes the running instance, which restarts its logon phase, and then exits. While waiting, the agent sleeps and uses practically no resources.

Which printer applies?

The agent takes the user’s SID and the group SIDs from the logon token – nested groups are already included there, and no AD query is needed to resolve groups. Then it applies a fixed order:

  1. Direct user assignment (by SID, otherwise by logon name)
  2. Group assignment with the smallest priority number (if equal: alphabetical by name)
  3. No assignment – the default printer is not changed

One check, step by step

Each check runs through the same steps:

  1. Turn off “Let Windows manage my default printer” for the user (HKCU\…\Windows NT\CurrentVersion\Windows, LegacyDefaultPrinterMode = 1) – once per session.
  2. Read the current default printer. If it matches the assignment (wildcards * and ? allowed), nothing happens.
  3. Otherwise look for a matching printer in the session. If it is a network printer (\\server\share) that is missing, connect it – at most one attempt every 5 minutes.
  4. Set the printer as default, read it back and log the change: Default printer set: '…' (previously: '…').

Why the Windows API matters in RDP sessions

In RDP sessions Windows stores the default printer per session (HKCU\…\Windows\SessionDefaultDevices). The registry value HKCU\…\Windows\Device and WScript.Network do not reflect the effective default printer there. WePrintEasy therefore reads and sets it with the Windows API functions GetDefaultPrinter and SetDefaultPrinter – exactly what the session really uses.

Logon phase and session monitoring

Redirected client printers appear with a delay after logon and then often become the default printer. That is why the agent checks every 3 seconds during the logon phase (default 120 seconds). After that, if “Monitor during session” is on, it checks in the configured interval (default 30 seconds, minimum 5) – for the whole session or for a limited number of minutes.

Before each check the agent looks at the configuration file’s timestamp and size and reloads it when it has changed. New assignments therefore reach running sessions without a new logon.

Logging

Every user has a log at %LOCALAPPDATA%\WePrintEasy\agent.log with the assignment, every correction and errors – written in the language set in the configuration (English or German). Warnings that would repeat in every round are only logged when they change. At 1 MB the log is rotated to agent.log.old. The admin console shows the log in the “Check user” tab.

Optional: RDS policy

With the option “Do not use the client PC’s default printer” the installer additionally sets the policy Do not set default client printer to be default printer in a session (HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services, fForceClientLptDef = 0). Alternatively you configure it via Group Policy.

Test the agent manually in a user session

powershell -ExecutionPolicy Bypass -File 'C:\Program Files\WePrintEasy\WePrintEasy-Agent.ps1' -Once -Verbose

More: Admin guide · Troubleshooting · System requirements

Give every user the right printer – from the next logon.

Try WePrintEasy on a test server first. Setup takes about two minutes.

Free · MIT licence