Shared printer script to specified pc names

We need a script for printers to be mapped through the print server on pc's and laptops.  For example \\servername\printer mapping to computername .  We have an enviorment with 5 Terminal servers.  The servers have all their printers installed locally through IP addresses.   We eventually want to have only the pc's and laptops using the print server.  We want to avoid a user who is on a pc to end up mapping printers that are from the print server when logging into any Terminal server. .  So in reality we want to do this by computer configuration and not user configuration.  
demichelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jodypeetCommented:
easy
heres a clip from the kix script i used a while ago to do exactly that.

;IF THIS IS THE SERVER THEN QUIT
If @WKSTA = "server1"
   Quit
EndIf
If @WKSTA = "server2"
   Quit
EndIf
If @WKSTA = "server3"
   Quit
EndIf
If @WKSTA = "server4"
   Quit
EndIf

Function CONNECTPRINTER($server,$printer)
   If $server <> @WKSTA ;DONT CONNECT TO LOCAL PRINTER
      $printerpath = "\\" + $server + "\" + $printer
      If AddPrinterConnection("$printerpath")=0
         UPDATESTATUS1("Connecting you to the " + $printer) ;FUNCTION
         Sleep 0.75
      EndIf
   EndIf
EndFunction


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
demichelAuthor Commented:
I put this script on the same login script in netlogon. but does'nt work.
I don't know if is correct or not the following script:

@ECHO OFF
%0\..\Kix32.exe

;IF THIS IS THE SERVER THEN QUIT
If @WKSTA = "uhcsts001"
   Quit
EndIf
If @WKSTA = "uhcsts002"
   Quit
EndIf
If @WKSTA = "uhcsts003"
   Quit
EndIf
If @WKSTA = "uhcsts004"
   Quit
EndIf
If @WKSTA = "uhcsts005"
   Quit
EndIf

Function CONNECTPRINTER($uhcsbdc1,$Bill_hp4250)
   If $uhcsbdc1 <> @WKSTA ;DONT CONNECT TO LOCAL PRINTER
      $printerpath = "\\" + $uhcsbd1 + "\" + $Bill_hp4250
      If AddPrinterConnection("$printerpath")=0
         UPDATESTATUS1("Connecting you to the " + $Bill_hp4250) ;FUNCTION
         Sleep 0.75
      EndIf
   EndIf
EndFunction

For each printer I need add Function CONNECTPRINTER ?

Thank you..
0
jodypeetCommented:
Do you use kix scripts or batch files for login scripts ?
if you already use kix we're ok, if it's batch files there are a few more steps
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.