Execute a script

herrolm used Ask the Experts™

i have a Remote Destkop Server (Terminal Server) installed on Win2008r2. There are 8 users that will logon from different thin clients and every user has two network printers connected.
My problem is, I want to set default printer depending on the thin client from which the user establish the connection. They only disconnect and reconnect to the session, they don't logoff and logon again.

i've already tried a scheduled task with the beginning trigger "On connection to user session" with the following command:
if %clientname% == THINCLT01 rundll32.exe printui.dll,PrintUIEntry /y /n \\printserver\printer1

Open in new window

... but unfortunately, the var %clientname% could not be resolved at the sheduled task. If I execute it in CMD while the user is logged on, it could be resolved and the command works without any problems.

Do you know a way to provide the default printer at the sesseion reconnect?

Thanks in advance!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Joseph MoodyBlogger and wearer of all hats.

Could you give each client a different IP subnet (with a /28 subnet)? Then you could deploy the printer using location awareness.


Not really, this isn't a solution in my opinion.
Get a tool called ReconnAct from Login Consultants. It allows you to set scripts to run once sessions are reconnected.


Cláudio Rodrigues
Microsoft MVP - RDS
Citrix CTP


thank you, that's exactly what i've been looking for!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial