+ Post New Thread
Page 4 of 4 FirstFirst 1234
Results 46 to 51 of 51
Windows Thread, need advice on assigning printers based on classroom in Technical; Just out of curiousty where is RIC's post and how did you get the client name versus the machine name ...
  1. #46

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,710
    Thank Post
    3,246
    Thanked 1,048 Times in 970 Posts
    Rep Power
    364

    Re: need advice on assigning printers based on classroom

    Just out of curiousty where is RIC's post and how did you get the client name versus the machine name ?

  2. #47

    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: need advice on assigning printers based on classroom

    Check out http://edugeek.net/index.php?name=Fo...iewtopic&t=404

    The important bit is

    Code:
    LCase(WshShell.ExpandEnvironmentStrings("%CLIENTNAME%"))
    The system has two variables on thin clients:
    * computername = the server's name
    * clientname = the client machine's name

    Hope this helps.

  3. #48
    accura2000's Avatar
    Join Date
    Apr 2007
    Location
    Ashford, Kent
    Posts
    176
    Thank Post
    17
    Thanked 34 Times in 23 Posts
    Rep Power
    20

    Re: need advice on assigning printers based on classroom

    I currently use con2prt.exe to assign printers to computers based on location.
    Just enter a location into the enviornment settings in windows and make yourself a logon script and hey presto. Work flawlessly for the last 18 months.

  4. #49
    Rozzer's Avatar
    Join Date
    Aug 2005
    Location
    South West
    Posts
    720
    Thank Post
    21
    Thanked 81 Times in 61 Posts
    Rep Power
    33

    Re: need advice on assigning printers based on classroom

    Here is a printer script which can be done by room and has been very easy to run. It was provided by our network migration.

    Processprinter.vbs
    Code:
    Option Explicit
    
    DIM ForReading
    
    DIM ForWriting
    
    DIM ForAppending
    
    DIM strComputer
    
    DIM WshNetwork
    
    DIM objWMIService
    
    DIM colInstalledPrinters
    
    DIM objPrinter
    
    DIM FileIn
    
    DIM FSO
    
    DIM WshShell
    
    DIM objEnv
    
    DIM ClientName
    
    DIM Username
    
    DIM objFile
    
    DIM Found
    
    DIM Wild
    
    DIM strContents
    
    DIM SpltInput
    
    DIM Col0
    
    DIM COl1
    
    DIM ColLen
    
    DIM UFound
    
    DIM UMatch
    
    DIM Match
    
    DIM objShell 
    
    DIM FN_Loop
    
    
    
    ForReading = 1
    
    ForWriting = 2
    
    ForAppending = 8
    
    strComputer = "."
    
    Set WshNetwork = CreateObject("WScript.Network")
    
    Set objShell = CreateObject("WScript.Shell")
    
    
    
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    
    Set colInstalledPrinters =  objWMIService.ExecQuery ("Select * from Win32_Printer")
    
    
    
    
    
    ON ERROR RESUME NEXT
    
    REM Delete all printers except for local ones.
    
    For Each objPrinter in colInstalledPrinters
    
    	If Left(objPrinter.Name,2) = "\\" Then
    
    		objPrinter.Delete_
    
    	End If
    
    Next
    
    ON ERROR GOTO 0
    
    
    
    FileIn = "\\clustaps\batch$\ClientPrinterMapping.txt"
    
    Set FSO = CreateObject("Scripting.FileSystemObject")
    
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    Set objEnv = WshShell.Environment("Process")
    
    
    
    FOR FN_Loop = 1 TO 5
    
    	Set WshShell = WScript.CreateObject("WScript.Shell")
    
    	ClientName = objEnv("COMPUTERNAME")
    
    	IF ClientName <> "" THEN EXIT FOR
    
    	Wscript.Sleep(5000)
    
    	IF FN_LOOP = 5 THEN
    
    		MSGBOX "Unable to read the computer name , please inform a technician."
    
    	END IF
    
    NEXT
    
    
    
    Username = objEnv("USERNAME")
    
    
    
    Set objFile = FSO.OpenTextFile(FileIn, ForReading)
    
    Found = 0
    
    Wild = 1
    
    Do While Not objFile.AtEndOfStream
    
    	strContents = objFile.ReadLine
    
    	SpltInput = split(strContents,VBTAB)
    
    	If ubound(SpltInput) > 0 Then
    
    		Col0 = SpltInput(0)
    
    		Col1 = SpltInput(1)
    
    		If UCase(Col0) = "NAME" THEN
    
    			ColLen = InStr(Col1,"*")
    
    			If Found  = 0 and Wild = 1 Then
    
    				IF COlLen > 0 Then
    
    					IF UCASE(Left(ClientName, ColLen -1)) = UCASE(Left(Col1, ColLen -1)) THEN
    
    						Found = 1
    
    						Wild = 1
    
    						Match = Col1
    
    					End IF
    
    				End If
    
    			End If
    
    			IF ColLen = 0 Then
    
    				IF UCase(ClientNAme) = UCase(Col1) THEN
    
    					Found = 1
    
    					Wild = 0
    
    					Match = Col1	
    
    				End If
    
    			End If
    
    		End If
    
    		IF UCASE(Col0) = "UNAME" THEN
    
    			IF UCase(Username) = UCase(Col1) THEN
    
    				UFound = 1
    
    				UMatch = Col1
    
    			End If
    
    		End IF
    
    	End If
    
    Loop
    
    objFile.close
    
    IF Found = 1 Then
    
    call Readblock("NAME",Match)
    
    END IF
    
    IF UFound = 1 Then
    
    call Readblock("UNAME",Username)
    
    END IF
    
    
    
    sub ReadBlock(Match1,Match2)
    
    Set objFile = FSO.OpenTextFile(FileIn, ForReading)
    
    	Do While Not objFile.AtEndOfStream
    
    		strContents = objFile.ReadLine
    
    		SpltInput = split(strContents,VBTAB)
    
    		If ubound(SpltInput) > 0 Then
    
    			Col0 = SpltInput(0)
    
    			Col1 = SpltInput(1)
    
    				If UCASE(Col0) = UCASE(Match1) AND UCASE(Col1) = UCASE(Match2) Then
    
    					Do While Not objFile.AtEndOfStream
    
    						strContents = objFile.ReadLine
    
    						SpltInput = split(strContents,VBTAB)
    
    						If ubound(SpltInput) > 0 Then
    
    							Col0 = SpltInput(0)
    
    							Col1 = SpltInput(1)
    
    							IF UCASE(Col0) = "MAP" Then
    
    								ON ERROR RESUME NEXT
    
    								FOR FN_Loop = 1 TO 5
    
    									WshNetwork.AddWindowsPrinterConnection Col1
    
    									IF Err.Number = 0 THEN EXIT FOR
    
    									Wscript.Sleep(5000)
    
    									IF FN_LOOP = 5 THEN
    
    										MSGBOX "Unable to map the printer " + Col1 + ", please inform a technician."
    
    									END IF
    
    
    
    								NEXT
    
    								ON ERROR GOTO 0	
    
    							End If
    
    
    
    							If UCASE(Col0) = "DEFAULT" Then
    
    								ON ERROR RESUME NEXT
    
    								FOR FN_Loop = 1 TO 5
    
    									WshNetwork.SetDefaultPrinter Col1
    
    									IF Err.Number = 0 THEN EXIT FOR
    
    									Wscript.Sleep(5000)
    
    									IF FN_LOOP = 5 THEN
    
    										MSGBOX "Unable to set the default printer to " + Col1 + ", please inform a technician."
    
    									END IF
    
    								NEXT
    
    								ON ERROR GOTO 0	
    
    
    
    							End If
    
    							If UCASE(Col0) = "NAME" OR UCASE(Col0) = "UNAME" Then
    
    								Exit Do
    
    							End If
    
    						End If
    
    					Loop
    
    				EXit Do
    
    				End If
    
    		End If
    
    	Loop
    
    objFile.close
    
    End sub
    You have this VBS file to run on each log in.

    You then make a txt file which will contain the following. This is a example.

    ClientPrinterMapping.txt
    Code:
    REM Room B11
    
    NAME	B11*
    
    MAP	\\apsrv01\B11_BW_HP4100
    
    MAP	\\apsrv01\B11_Colour_TallyT8006e
    
    DEFAULT	\\apsrv01\B11_Colour_TallyT8006e
    
    
    
    REM Room B12
    
    NAME	B12*
    
    MAP	\\apsrv01\B12_BW_HP4100
    
    MAP	\\apsrv01\B12_Colour_TallyT8006e
    
    DEFAULT	\\apsrv01\B12_BW_HP4100
    
    
    
    REM B13
    
    NAME	B13*
    
    MAP	\\apsrv01\B13_BW_HP4050
    
    MAP	\\apsrv01\B13_Colour_TallyT8006e
    
    DEFAULT	\\apsrv01\B13_BW_HP4050
    Its very easy and i have never had to touch the VBS file only the txt file.

    Sorry for the long post.

    Ross

  5. #50

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123

    Re: need advice on assigning printers based on classroom

    Quote Originally Posted by accura2000
    Just enter a location into the enviornment settings in windows and make yourself a logon script and hey presto.
    I always love the "just enter a ..." type things :-) These are always the bits which get forgotten (because it's one extra thing to do) :-)

  6. #51

    Join Date
    May 2008
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    hi everybudy,

    i was looking for the information on printers' networking... so at last i am here...

    thanks for the providing the very useful information for mapping of networked printers ...



    P.S. Web Link here are also very informative

SHARE:
+ Post New Thread
Page 4 of 4 FirstFirst 1234

Similar Threads

  1. Mapping Printers based on Location
    By NeoNemesis in forum Windows
    Replies: 11
    Last Post: 6th August 2007, 08:03 AM
  2. 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
  3. Problem assigning printers at logon - SOLVED
    By richard in forum Wireless Networks
    Replies: 12
    Last Post: 4th January 2007, 09:14 AM
  4. Setting Printers Based On Room Location
    By ICTNUT in forum Scripts
    Replies: 34
    Last Post: 13th May 2006, 08:19 PM
  5. monochrome printers for classroom use
    By broc in forum Hardware
    Replies: 10
    Last Post: 7th February 2006, 12:19 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
  •