+ Post New Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 35
Scripts Thread, Setting Printers Based On Room Location in Coding and Web Development; Hello All, Does anyone have any scripts that set printers based on room location. My Scenario: We have 6 IT ...
  1. #1
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    63

    Setting Printers Based On Room Location

    Hello All,

    Does anyone have any scripts that set printers based on room location.

    My Scenario:

    We have 6 IT Suites in each one a colour laser and mono laser, when a person (does not matter who) logs onto a machine in that room the printers in the will be mapped and made available.

    All printers are network'd.

    Ideally I would like to set the printers via GPO but have not yet found a way to do this but given time...... ;-)

    Any pointers would be cool.

    Oh Yeah, each machine have a unique name and the computer description has the following "Room XX - PC XX"

  2. #2

    Join Date
    Jun 2005
    Location
    Elgin, Scotland
    Posts
    387
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    24

    Re: Setting Printers Based On Room Location

    About five threads down in this forum...

    Printer Scripts Thread

  3. #3
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    63

    Re: Setting Printers Based On Room Location

    Thanks RobC,

    I really need to learn to search....

  4. #4

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,850
    Thank Post
    110
    Thanked 598 Times in 514 Posts
    Blog Entries
    1
    Rep Power
    227

    Re: Setting Printers Based On Room Location

    Heh, don't worry about it. BTW, if you get stuck feel free to post. I've hacked Rics script to bits to do what I wanted. I'm sure you'll end up in the same boat.

  5. #5
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    63

    Re: Setting Printers Based On Room Location

    Geoff,

    After a heck of alot of digging I have found that the computer description is held in the registry.

    I have used Ric's script as a basis and added a registry lookup to get the computer description (ours are set as Room XX - PC XX, and PC names are all unique as per the counties naming convention).

    Anyhow as we are only reading a reg key no special permissions are required so finally (after about 3 weeks of hunting) I can get the printers sorted ;-)

  6. #6

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,053
    Thank Post
    3,585
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377

    Re: Setting Printers Based On Room Location

    Hey ICT NUT, Any chance you can post back with the working script when you get it tweaked and finished, if thats ok ?

    As I'm sure that would be useful to some degree

  7. #7

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    Boston, MA
    Posts
    7,601
    Thank Post
    110
    Thanked 771 Times in 599 Posts
    Rep Power
    183

    Re: Setting Printers Based On Room Location

    @ICTNUT: Stick the modification into the post with the script so that others may find it more easily

  8. #8
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,007
    Thank Post
    124
    Thanked 286 Times in 263 Posts
    Rep Power
    109

    Re: Setting Printers Based On Room Location

    You can query AD for a description as well.

  9. #9
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    63

    Re: Setting Printers Based On Room Location

    @ChrisH: I agree you can query the AD but that requires special permissions and although you can impersonate in some cases a username and password must be supplied. Not happy about providing those in plain text.

    @Ric_ & Gecko: I am testing the script within the school now and will post up later today.

  10. #10
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,007
    Thank Post
    124
    Thanked 286 Times in 263 Posts
    Rep Power
    109

    Re: Setting Printers Based On Room Location

    I havent tested it but I would have thought it would have worked in the context of a log on script. My log in script querys ad for group membership with no problem. It must be different for computer objects I take it?

  11. #11
    thom's Avatar
    Join Date
    Jul 2005
    Location
    Bedford, East Anglia, UK
    Posts
    242
    Thank Post
    4
    Thanked 6 Times in 5 Posts
    Rep Power
    21

    Re: Setting Printers Based On Room Location

    I haven't read the links but this is a quick and basic way to get a network printer added.

    If you type

    %systemroot%\system32\rundll32.exe printui.dll,PrintUIEntry /ga /n \\SERVER_NAME\PRINTER_NAME

    in a command prompt it will add the printer for all users who log on to that PC.

    It does mean you need to do it on each computer and redo everytime you change the share name but is simple enough to add that line to a logon script, for each room (OU) of computers throgh Group Policy and AD, if you want.

  12. #12

    Join Date
    Aug 2005
    Location
    Farnborough, Hants, England
    Posts
    43
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Setting Printers Based On Room Location

    WE use a VBS script. Specifies a specific printer based on the room and machine name.

    Machine name a1-01-XX (xx being the machine number in room A1-01)

    To see the properly better paste in to notepad.

    rem Printer Mapping Script

    Const NetworkMapped = "\\"
    On Error Resume Next

    Set objNetwork = CreateObject("WScript.Network")

    Set colPrinters = objNetwork.EnumPrinterConnections
    For i = 0 to colPrinters.Count -1 Step 2
    strPrinterName = colPrinters.Item(i)
    strPrinterUNC = colPrinters.Item (i + 1)
    If Left(strPrinterUNC,2) = NetworkMapped Then objNetwork.RemovePrinterConnection(strPrinterUNC)
    Next

    'And now to map the required printers
    'Capture the Computer name, take the first 5 characters to determine the classroom
    'Then map the relevant printers for that classroom

    strComputerName = Left(objNetwork.ComputerName, 5)
    Select Case strComputerName
    Case "A1-01"
    bjNetwork.AddWindowsPrinterConnection "\\servername\printername"
    objNetwork.SetDefaultPrinter "\\servername\printername"

    End Select

    If you need add more insert more lines add them in before the end select command. The number 5 specifies the number of characters to use from the start of the name. So 3 would pick up in our case "A1-"

    Hope this helps

  13. #13

    SpuffMonkey's Avatar
    Join Date
    Jul 2005
    Posts
    2,269
    Thank Post
    55
    Thanked 285 Times in 191 Posts
    Rep Power
    136

    Re: Setting Printers Based On Room Location

    Quote Originally Posted by thom
    I haven't read the links but this is a quick and basic way to get a network printer added.

    If you type

    %systemroot%\system32\rundll32.exe printui.dll,PrintUIEntry /ga /n \\SERVER_NAME\PRINTER_NAME

    in a command prompt it will add the printer for all users who log on to that PC.

    It does mean you need to do it on each computer and redo everytime you change the share name but is simple enough to add that line to a logon script, for each room (OU) of computers throgh Group Policy and AD, if you want.
    This is roughly what I use - but I put a little txt file on each PCs C: drive and then set the printer depending on what the name of the txt file is - so for example in the IT Suite its IT.txt, and the printer line does an IF EXIST (I think) and runs if the name matches - so theres a bat file that runs through about 30 printers at login - but its very quick. You can add the /y argument to set as default too.

    See - http://www.robvanderwoude.com/index.html

  14. #14

    Join Date
    Jun 2005
    Location
    Leeds
    Posts
    113
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Setting Printers Based On Room Location

    I'd use the method mentioned above with the printui.dll

    put all yout workstations in OUs by Room

    On the workstation policy (computer configuration) / windows settings / Scripts / Startup script

    add a batch file with the relevant printers for that room, using the printui.dll method.

    All you need to do to give a computer the right printers is move it into the relevant OU. All the users that logon will get printers specific to that room.

  15. #15

    Join Date
    Jul 2005
    Location
    Corby
    Posts
    1,056
    Thank Post
    12
    Thanked 20 Times in 18 Posts
    Rep Power
    25

    Re: Setting Printers Based On Room Location

    OK. These posts are really great- we have some VB scripts running (kind of) and set up by CSE engineers in the past; there's a utility we have in their software that sets these to autorun at login. They worked until last week, and now they sometimes work and sometimes don't. Pathetic really.

    Not being a scripter myself, could someone tell me where to put Ric's excellent script so that I can modify it and test it? I know Group Policy pretty well and I'm aware that logon scripts can go in the "Startup Script" section, but once in my SYSVOL/Scripts folder do I merely browse for the file in the GPO or paste the actual contents in there (as I was told to do this week)?

    Basically I want the script to check the first 4 letters of the location and choose a default printer from there (e.g. ICT 6 ICT 5 etc etc). Am I right in assuming that since Ric's script chooses the default location based on station name that I could drop it in at the top-level of the Stations OU we have rather than appying it to each OU??

    /Ramble

    Thanks!

    Paul



SHARE:
+ Post New Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 50
    Last Post: 19th May 2008, 01:24 PM
  2. Room Booking Database/Web based (.asp)
    By danIT in forum Downloads
    Replies: 131
    Last Post: 7th November 2007, 11:20 AM
  3. Mapping Printers based on Location
    By NeoNemesis in forum Windows
    Replies: 11
    Last Post: 6th August 2007, 09:03 AM
  4. Assinging printers to clients based on OU
    By originofsymmetry in forum Network and Classroom Management
    Replies: 3
    Last Post: 11th July 2007, 07:02 AM
  5. Thinking of setting up a Thin Client in on room.
    By tosca925 in forum Thin Client and Virtual Machines
    Replies: 5
    Last Post: 29th June 2006, 08:53 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •