+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 35
Scripts Thread, Setting Printers Based On Room Location in Coding and Web Development; Originally Posted by kingswood Not being a scripter myself, could someone tell me where to put Ric's excellent script so ...
  1. #16

    Join Date
    Jun 2005
    Location
    Preston, Lancashire
    Posts
    634
    Thank Post
    11
    Thanked 6 Times in 6 Posts
    Rep Power
    21

    Re: Setting Printers Based On Room Location

    Quote Originally Posted by kingswood
    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)?
    I put mine in netlogon and browse for it in GP. I think there is a default location where scripts go otherwise 'per policy'. I'm sure you could put it pretty much where you wanted, but you'd have to get the permissions right - obviously sorted if it goes in netlogon!

    Quote Originally Posted by kingswood
    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??
    Exactly right, but I think you'll find you need to put your script in the Logon Scripts policy under User Config (but for the machine's policy!)



    Andy.

  2. #17

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180

    Re: Setting Printers Based On Room Location

    Here's my updated script which checks the first four characters of the computer name. Simply change the characters that are searched for in the case statement and the printer shares accordingly (more can be added before the 'case else' statement).

    I tend to keep the script in the NETLOGON share and it is applied by GPO on the Users OU (inside which I have OUs for staff and pupils). The script should be run as a login script - not a startup script. Don't run it as an admin or on the print server as all the printers will disappear from your server!
    Attached Files Attached Files

  3. #18

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

    Re: Setting Printers Based On Room Location

    Thanks to all for the replies- I'll be trying Ric's script out today or tomorrow.

    Paul :-)

  4. #19

    Join Date
    Oct 2005
    Location
    Hull, East Yorkshire
    Posts
    23
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Setting Printers Based On Room Location

    Quote Originally Posted by Ric_
    Here's my updated script which checks the first four characters of the computer name. Simply change the characters that are searched for in the case statement and the printer shares accordingly (more can be added before the 'case else' statement).

    I tend to keep the script in the NETLOGON share and it is applied by GPO on the Users OU (inside which I have OUs for staff and pupils). The script should be run as a login script - not a startup script. Don't run it as an admin or on the print server as all the printers will disappear from your server!
    We would be willing to try this, however, does the VB script delete all of the network printers if a teacher was to log onto their laptop where the printers are all set up (i.e. networked photocopiers). Also does this script take very long to run?

    We are currently using the rundll method but have found that this sometimes does not work properly and want to see if there is anything else out there.

  5. #20
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,524
    Thank Post
    106
    Thanked 88 Times in 74 Posts
    Blog Entries
    46
    Rep Power
    40

    Re: Setting Printers Based On Room Location

    have never had any problems with the rundll method using a batch script that features lots of sections like:

    if %computername:~0,3% == A8- (
    rundll32 printui.dll,PrintUIEntry /in /n \\print1\A8Laser
    rundll32 printui.dll,PrintUIEntry /y /n \\print1\A8Laser /q
    echo A8 Printer connected.
    goto END
    )

    ideally best 2 have 2 identical print servers so if there's a problem with one u can just alter the batch script so printers are mapped from the other.

  6. #21

    Join Date
    Oct 2005
    Posts
    40
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Setting Printers Based On Room Location

    An old Microsoft NT4 tool exists called Con2Prt.exe which connects and disconnects printers via a DOS command line command.

    Using this utility as described will provide a user with a list of printers available to the workstation they are logging on at. The list of available printers and the default printer can be defined per machine usually on a room basis.

    You just put a variable on it and its a doddle to use - here is a good link with instructions and how to get it

    http://www.rangersuite.com/support/k...%20con2prt.exe

  7. #22
    mark's Avatar
    Join Date
    Jun 2005
    Posts
    3,958
    Thank Post
    248
    Thanked 49 Times in 45 Posts
    Blog Entries
    2
    Rep Power
    46

    Re: Setting Printers Based On Room Location

    Quote Originally Posted by browolf
    have never had any problems with the rundll method using a batch script that features lots of sections like:

    if %computername:~0,3% == A8- (
    rundll32 printui.dll,PrintUIEntry /in /n \\print1\A8Laser
    rundll32 printui.dll,PrintUIEntry /y /n \\print1\A8Laser /q
    echo A8 Printer connected.
    goto END
    )

    ideally best 2 have 2 identical print servers so if there's a problem with one u can just alter the batch script so printers are mapped from the other.
    I like this method! How do you find the switches for that command?

  8. #23

    Join Date
    Aug 2005
    Location
    Shropshire
    Posts
    284
    Thank Post
    16
    Thanked 11 Times in 8 Posts
    Rep Power
    21

    Re: Setting Printers Based On Room Location

    I've got a really good script that will do exactly this, you can add the variable that says if the computer name starts with "xxx" then add a printer "xyz" as the default

    Will send it on Monday when I get back into work

    Regards

    Matt

  9. #24

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180

    Re: Setting Printers Based On Room Location

    @luke213: Simply edit the script so that it behaves differently for computers named <whatever> and have it not run the remove printers section. An if.. not statement should do the trick.

  10. #25
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,421
    Thank Post
    10
    Thanked 486 Times in 426 Posts
    Rep Power
    110

    Re: Setting Printers Based On Room Location

    First thing to say is Hi! (First post)

    I just thought I would make a couple of comments as I used a similar script where I work.

    I spent a number of hours when I first used a vbs script to add printers trying to work out why they appeared but didn't always work. If you are only a domain user, you are allowed to add printers via a vbs script, but you aren't allowed to install the drivers. If this is the case, you get attached to the network printer but can't actually print, you get a nice error instead.

    The way I get around printer drivers is to run a slighly modified version also as the startup script. As this script runs as system, it is allowed to install new drivers, then when the user logs in, they don't need to install drivers and it all works.

    One other thing I would mention is that I have "wsh.sleep 5000" between adding a printer and making it default, sometimes it takes a second or two to finish adding the printer, and with multiple printers the default command sometimes is run before the printer exists.



    I also have a WMI script that removes the Microsoft Document imager if anyone is interested, you can't seem to access it via vbs as it has a funny name.

    David

  11. #26

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180

    Re: Setting Printers Based On Room Location

    @DMcCoy: Would love the WMI script

  12. #27
    DMcCoy's Avatar
    Join Date
    Oct 2005
    Location
    Isle of Wight
    Posts
    3,421
    Thank Post
    10
    Thanked 486 Times in 426 Posts
    Rep Power
    110

    Re: Setting Printers Based On Room Location

    Quote Originally Posted by Ric_
    @DMcCoy Would love the WMI script
    you can do it within the vbs file, but again, this one has to run as the startup script (in fact I guess it can be a seperate startup script on its own).

    I think this is the relevant bit, test it first

    Code:
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colInstalledPrinters =  objWMIService.ExecQuery ("SELECT * FROM Win32_Printer")
    For Each objPrinter in colInstalledPrinters
    	IF objPrinter.Name = "Microsoft Office Document Image Writer" THEN
    		objPrinter.Delete_
    	END IF
    Next
    mind the word wrap

  13. #28
    mark's Avatar
    Join Date
    Jun 2005
    Posts
    3,958
    Thank Post
    248
    Thanked 49 Times in 45 Posts
    Blog Entries
    2
    Rep Power
    46

    Re: Setting Printers Based On Room Location

    what's this bit: "\root\cimv2" ?

  14. #29

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,802
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Setting Printers Based On Room Location

    the WMI management root path.

  15. #30
    mark's Avatar
    Join Date
    Jun 2005
    Posts
    3,958
    Thank Post
    248
    Thanked 49 Times in 45 Posts
    Blog Entries
    2
    Rep Power
    46

    Re: Setting Printers Based On Room Location

    which is... [hehe]

    Is that it? is that the path? - not a reference to any specific path or machine - but syntax for the WMI root path generically?

SHARE:
+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Replies: 50
    Last Post: 19th May 2008, 12:24 PM
  2. Room Booking Database/Web based (.asp)
    By danIT in forum Downloads
    Replies: 131
    Last Post: 7th November 2007, 10:20 AM
  3. Mapping Printers based on Location
    By NeoNemesis in forum Windows
    Replies: 11
    Last Post: 6th August 2007, 08: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, 06: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, 07: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
  •