Rebuilding printers when users lock and unlock
Out of the box, ScrewDrivers rebuilds a user's printers when they log on, and again whenever their session disconnects and reconnects. It ignores Windows lock and unlock events. That's the right default for most session hosts, but it leaves one group behind: people whose printer assignments depend on where they are. A laptop user who's assigned printers by IP address or subnet, docks at a different site, and unlocks their machine still sees yesterday's printers until they log off, reboot, or click Refresh in ScrewDrivers Printers.
A single registry value changes that. When HandleLockNotifications is enabled, the ScrewDrivers Notification Service processes a lock exactly as it would a session disconnect (printers are removed) and an unlock exactly as a reconnect (printers are rebuilt against the current assignments and the current network address). Because a lock nearly always happens before the user moves and the unlock after they've settled, the rebuild sees the new location.
You'll need local administrator rights on the session host where the session agent runs. That's the remote session host in RDS, Citrix, or VDI deployments, or the desktop itself when applications run locally. This setting is honored by ScrewDrivers Pro and Enterprise session hosts running v7.
The rebuild on unlock relies on the session setting Delete printers on session disconnect; add on reconnect, which is on by default. If you've turned it off, unlock has nothing to rebuild. See Print Server session settings and Endpoint session settings.
Enable lock and unlock handling
The value lives under the shared Tricerat key, is a DWORD, and defaults to 0 when it's absent.
| Setting | Value |
|---|---|
| Key | HKEY_LOCAL_MACHINE\SOFTWARE\Tricerat\Common |
| Value name | HandleLockNotifications |
| Type | REG_DWORD |
| Data | 1 to process lock/unlock as disconnect/reconnect; 0 (default) to ignore them |
- On the session host, open Registry Editor and go to
HKEY_LOCAL_MACHINE\SOFTWARE\Tricerat\Common. - Create a DWORD (32-bit) value named
HandleLockNotificationsand set it to1. - Restart the ScrewDrivers Notification Service. The service reads this value when it starts, so the change doesn't take effect until then. A reboot works too.
- Test it: lock the machine with Win+L, unlock it, and open ScrewDrivers Printers or the Windows printers list. You'll see the printers disappear on lock and come back on unlock, with a short delay while they rebuild.
If you'd rather script it, this PowerShell does the same thing from an elevated prompt:
New-ItemProperty -Path 'HKLM:\SOFTWARE\Tricerat\Common' -Name 'HandleLockNotifications' -PropertyType DWord -Value 1 -Force
Restart-Service -Name 'ScrewDrivers Notification Service'
For new installs, you don't have to touch the registry at all. The Pro and Enterprise installer accepts OPTION_HANDLE_LOCK_NOTIFICATIONS=1 on a silent command line and writes the same value for you. See Silent Install Switches (v7.3.1 or newer).
What to expect afterward
Every lock now costs a printer teardown and every unlock a rebuild, which is the same work a disconnect and reconnect would do. On a session host with a handful of printers per user that's a few seconds and users rarely notice. If your users have dozens of printers or lock their screens constantly, weigh that against the benefit; you can always set the value back to 0 and restart the service to return to the default behavior.
A sibling value in the same key, HandleConsoleNotifications, does the same job for console connect and disconnect events, which matter with fast user switching or when someone walks up to the physical console of a machine that also hosts remote sessions. It's also a DWORD, also off by default, and also needs a service restart.
When you need a refresh on demand
Lock handling covers the roaming case automatically. For everything else, ScrewDrivers Printers has a Refresh button on its Settings tab, and the same rebuild can be triggered from a script or a scheduled task. See Refreshing session printers from the command line.
Related pages
- Print Server session settings, for the disconnect and reconnect behavior this setting builds on
- Endpoint session settings, the equivalent for redirected client printers
- Silent Install Switches (v7.3.1 or newer), to set the value at install time