Solved

script to change default printer, W2k3 Server

Posted on 2007-12-03
8
954 Views
Last Modified: 2013-11-21
I need a script to run when each user logs in that will map their printer and ignore the printer that the TS session specifies. How do I do this?
0
Comment
Question by:pkromer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 31

Expert Comment

by:Cláudio Rodrigues
ID: 20399788
First of all, are they on the same LAN as the TS? If not you need to remember you will not be able to map anything on their local computer as SMB does not work over RDP.
Secondly, if you really need to do that you must disable RDP printing first. Did you do that?
And finally why do you need to do that? What is the exact reason for not using TS the way it is designed for?

Claudio Rodrigues

Microsoft MVP
Windows Server - Terminal Services
0
 

Author Comment

by:pkromer
ID: 20399852
There are two of 20 people who are not on the local LAN, they work from home and rdp in.

I have not disabled rdp printing. Where is that done?

The reason for all this is that every time a user logs in, depending on the order that others log in, the server assigns them a different printer. For example, if user 1 normally uses a share set up on user 2's client, but user 2 is not logged in, then user 1 gets whatever printer the server decides to give it. I admit, I haven't looked into it to set it up as proper as it should be, but it occurred to me that the simplest, most solid thing would be to tell the server to use user 1's client printer whenever user 1 logs in. It seems like the printer setup keeps getting whacked over time, no matter how I try to tighten it up. I just wanted to take the server out of the loop and specify myself who gets which printer.

Is that not a good thing to do?
0
 

Author Comment

by:pkromer
ID: 20400392
I figured it out...

if "%username%"=="UserOneName" (
  rundll32 printui.dll,PrintUIEntry /y /n "\\user1s_pc\printerx"
)
if "%username%"=="UserTwoName" (
  rundll32 printui.dll,PrintUIEntry /y /n "\\user2s_pc\printerz"
)

etc.

0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 31

Expert Comment

by:Cláudio Rodrigues
ID: 20400437
Well I still do not understand what you are trying to do.
If you share a LOCAL printer on the USER PC, this printer/share will never change and will be there as long as the machine is on.
But if you share a printer that was created on the TS session then the story is different as that printer name changes every time the user logs in and if he is not logged on to the TS other users cannot print to that printer. This is what is a bad practice on TS. You are not supposed to share the printers created by the TS itself. Is this what you are trying to do?

Claudio Rodrigues

Microsoft MVP
Windows Server - Terminal Services
0
 

Author Comment

by:pkromer
ID: 20400525
No, I think I wanted to do the opposite of what you said. I do NOT want to share the printers created by TS, in fact I don't want them at all. I wanted to tell TS which printer goes with which user. That snippet does the trick, named as a bat file and run as a logon script. I am all ears though to hear why I shouldn't be doing this :-)
0
 

Accepted Solution

by:
pkromer earned 0 total points
ID: 20567413
I ended up creating a script, shown above, which will specify exactly which printer a user will use, and this script runs on login. No matter which printer the TS session thinks is default, this script overwrites it for each and every session, giving me full control over which printer gets used by whom. Thanks very much for the effort in trying to remedy my problem.
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20593846
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After having deployed hundreds of thousands of Terminal Services seats worldwide, I still see all the time people asking me that same old question: "If TS/RDS is that reliable why are you telling me I should reboot it that often? My DC/SQL/Exchange/…
This is my 3rd article on SCCM in recent weeks, the 1st (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/A_4466-A-beginners-guide-to-installing-SCCM2007-on-Windows-2008-R2-Server.html) dealing with installat…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question