?
Solved

Adding Printers to Staff but not students

Posted on 2009-02-23
2
Medium Priority
?
250 Views
Last Modified: 2012-05-06
Hi
We have used a VB Script to assign printers to specific rooms which has been working great. What we want to do is assign 2 new printers to all teacher PC's but not student PC's. Teachers PC's are usually formatted like this "BC1-Teacher" with the room name preceeding the hyphen. Student machines would therefore be "BC1-01, BC1-02 etc".

Ideally we would like some for of wildcard to include "teacher" so that 2 reprographics printers could be assigned to all staff. Not really up to speed on VB Script but it is a remnant from a previous technician and it works.

Any help would be appreciated.
'----------------------Adds the printer based on the computer name---------------------------------------------------
 
Function AddPrinter(Room, Printer)		
 NamePos = InStr(Lcase(CompName),Lcase(Room)) 	'If the Room Name is in the Computer Name
  If NamePos <> 0  then
    'Adds Network Printer
     PrinterToAdd="\\printsupp\" & Printer
     objNetwork.AddWindowsPrinterConnection(PrinterToAdd)
     objNetwork.SetDefaultPrinter PrinterToAdd
  End If
End Function
 
AddPrinter "BC1","BC1"

Open in new window

0
Comment
Question by:alumwell
2 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 2000 total points
ID: 23713277
Try this.

OM Gang
Function AddPrinter(Room, Printer)		
 NamePos = InStr(Lcase(CompName),Lcase(Room)) 	'If the Room Name is in the Computer Name
  If NamePos <> 0  then
    'Adds Network Printer
     PrinterToAdd="\\printsupp\" & Printer
     objNetwork.AddWindowsPrinterConnection(PrinterToAdd)
     objNetwork.SetDefaultPrinter PrinterToAdd
  End If
    'check to see if this is a teacher computer
  NamePos = InStr(Lcase(CompName),Lcase("Teacher"))
  If NamePos <> 0 Then
    'add network printer
    PrinterToAdd = "\\prinsupp\nameofthereprographicsprinter"
     objNetwork.AddWindowsPrinterConnection(PrinterToAdd)
     objNetwork.SetDefaultPrinter PrinterToAdd
  End If
End Function

Open in new window

0
 

Author Closing Comment

by:alumwell
ID: 31550064
Perfect :) many thanks for the help on this one.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 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