• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

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.  
0
demichel
Asked:
demichel
  • 2
1 Solution
 
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
 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now