Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

terminal services default printer changes

Status
Not open for further replies.

hamzajosh

Programmer
Sep 18, 2002
182
0
0
US
My users use terminal services via thin clients. I have 2 network printers. I want one set of users to have their default printer as a particular printer. Whenever they log in, default printer is set ambigiously sometimes to one and sometimes to other. I want them to have it set to a particular printer every time they log in. Where and how do i set this up? thanks
 
Try kixtart for login script. I used to login as new user to every citrix server to setup their printer, but since I use kixtart, they'll have 3-4 printers when they login locally and only main printer if they login to citrix.
 
Need help on above problem, how to set a default printer for a user so everytime they log in in terminal server, the default printer is set to that one particular printer. thanks

Learn everything but implement only what is needed.
 
You can implement a vbscript login script that sets the default printer.

Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.SetDefaultPrinter "\\Server\HP5si"

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark, please gimme details on how to implement it. My domain controller is a separate server (NT SBS 4.5) and terminal server (WIN2K) is member server. My users are not setup on terminal server, they are on domain controller. How do i make the script? where do i put it? where do i set the script to run when user logs in? etc. Thanks a lot.

Learn everything but implement only what is needed.
 
You would need to save the code to a text file and give it a name ending in a VBS extension.

You will need to refresh my memory, does NT4 User manager have a place for Terminal Services login script? I can't recall if it does. You can put an entry for the script there and just have it point to an accessible share location where you will store the file.

If NT4 does not have that option let me know and I'll add some code for you and tell you how you can get past this stumbling block.

Let me know one thing, will the same users always be getting the same printer, or do they move around and need a different printer depending on machine?

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark, there is a place in NT to put a login script but I want the login script to run when a user logs into terminal server. If i put it into the NT box, it will run everytime a user logs into the DOMAIN. I have thin clients where this will work fine because they log in to both servers at same time but i also some usual PC's from where they run TS client where the problem will occur. Also in the script,

Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.SetDefaultPrinter "\\Server\HP5si"

do i just replace "\\Server\HP5si" with my printer name? Any other changes? Also a text file with vbs extension will run as it is or does it have to run from a VB engine or something? Please advise, thanks, Hamza

Learn everything but implement only what is needed.
 
Hi Hamzajosh,

OK so sounds like NT4 does not support a seperate location for a TS Login Script (Win2K and Win2K3 do). So, you could simply make that script and put it in the All Users StartMenu\Startup folder to have it map the printers each time the user logs in.

VBS files will run by themselves using the Windows Script Host Engine. This is already installed on your 2K box by default. If you want to upgrade it to V5.6 that is a good idea. You can download it from Microsoft.com/scripting.

You are correct about the script, just change the name of the printer share to your server and printer share name.

The tricky part here is you have multiple printers you want to direct people to. Using the AllUsers trick will not work well in that case. You may need to give people their own copy of the script and have them (or you) add it to their StartUp group so you can make sure each sure is directed to the right place.

As a side note, with Windows 2003 this would be a non-issue because of the new printer redirection features. If you can upgrade your server it is well worth it.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Thanks mark, that was good, i will try it and let u know if it works. Thanks again.

Learn everything but implement only what is needed.
 
Mark, I tried ur script from remote machine and it works fine but if i put it locally on the terminal server and run it, it says there is no printer called "\\terminalserver\main Printer"
if i remove the terminal server and just put "main printer" the script runs without error but does not change the default printer. Any suggestions would be helpful, thanks.

Learn everything but implement only what is needed.
 
Check to see if you have NetBIOS over TCP/IP enabled on the Terminal Server. The script should have run as you had it originally.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
This may be a little late but was just purusing the forums and read this thread. NT 4.0 does have a place to specify a TS login script. The catch is you have to run User Manger on a Terminal Server.

I know this was true with NT 4.0 Terminal Server Edition. I'm don't have an environment to test this, but I'm 99% sure if you run User Manger for Domains on the Win2k TS server you will see a Terminal Server properties tab on each user account.

I could be wrong, but try it and see!

-- lacitrixuser
 
Hamzajosh,

I found a place where you can specify a login script to ONLY execute on a TS box. I have that doc at work. Will post back with details. Requires a registry edit.

Mark

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
OK, here it is as promised.

Place your login script on the Terminal Server in the %SystemRoot%\System32 directory.

Open Regedit and navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon

Double Click Appsetup

Edit the value by adding a comma at the end of the current value and add the name of your login script.

Example:
If the value was: Userlogon.cmd,Rmvlinks.exe

You would change it to: Userlogon.cmd,Rmvlinks.exe, myScript.vbs


This script will then execute whenever a user logs on to the TS box.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark, I implemented your login script by adding it to the users' startup whose default printer I wanted to change. I do not want all users in TS to have this default printer which was what your suggestion would do. Anyways the post was helpful in understanding the concept and implementing any further scripts that i need to execute for every user. Thanks a lot.

Learn everything but implement only what is needed.
 
Glad to be of service. Rather than having to add this to each users startup group you could do the singe script and have it check for a group membership to determine what printer to set as the default.

Just a suggestion. It is more work on the script creatin but less work on the upkeep.

I can give you a sample if you need it on how to check for the group memberships.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Yeah that would be awesome if you can give me the script to check for group membership. thanks

Learn everything but implement only what is needed.
 
Here you go. This login script checks for the group memberships. You can easily put your printer mappings in for the groups where I have network drive mapping going on. The section that checks for the group memberships is in the Select Case section. let me know if it doesn't make sense to you after looking it over a few times.


'==========================================================================
'
' NAME: LogonScript
'
' AUTHOR: Mark D. MacLachlan, The Spider's Parlor
' URL : ' DATE : 4/10/2003
'
' COMMENT: Enumerates current users' group memberships in given domain.
'
'==========================================================================


ON ERROR RESUME NEXT

Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
DomainString = "DomainName"
UserString = WSHNetwork.UserName

Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)

'Synchronizes the time with Server our NTP Server
WSHShell.Run "NET TIME \\Server /set /y"


WSHNetwork.RemoveNetworkDrive "F:"

wscript.sleep 300

'Maps drives needed by all
WSHNetwork.MapNetworkDrive "U:", "\\server\users",True
WSHNetwork.MapNetworkDrive "X:", "\\server\executables",True

'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups

Select Case GroupObj.Name
'Check for group memberships and take needed action
Case "Admin"
WSHNetwork.MapNetworkDrive "w:", "\\Server\Admin Stuff",True
Case "WorkerB"
WSHNetwork.MapNetworkDrive "w:", "\\Server\Shared Documents",True

End Select

Next


'Install Printers

WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"



set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing

wscript.quit


I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark, thanks for the script. I will try it out and get back to you with results. Where can I get the all details (functions, methods etc) for VB Scripting?

Learn everything but implement only what is needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top