pkromer
asked on
script to change default printer, W2k3 Server
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?
ASKER
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?
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?
ASKER
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.
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.
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
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
ASKER
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 :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
Vee_Mod
Community Support Moderator
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