+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
Windows Server 2000/2003 Thread, Print Management per-computer GPO delivery in Technical; This script .vbs is very nifty... but doesn't really like W7 PC's because of the UAC.. but with XP it's ...
  1. #16

    Join Date
    Feb 2011
    Posts
    82
    Thank Post
    1
    Thanked 5 Times in 4 Posts
    Rep Power
    7
    This script .vbs is very nifty... but doesn't really like W7 PC's because of the UAC.. but with XP it's a beauty.
    Firstly you create the script like below. As you will notice it refers to a txt file which I will show you in the next post



    'Dimming Variables

    dim comname
    dim printerpath
    dim fileexist
    dim listline
    dim list
    dim counter
    dim intval 'General Storage for temp values
    '_________________________________________________ _________

    'Creating Objects
    set fileaccess=createobject("Scripting.filesystemobjec t")
    set networkaccess=createobject("Wscript.network")
    '_________________________________________________ _________



    'Check existence of the list file
    fileexist=fileaccess.fileexists("\\myserver\netlog on\list.txt")

    if fileexist="False" then
    msgbox "Connection List is not available! Printer connection abort.",,"Printer Connection abort"
    else
    'open list
    set list = fileaccess.OpenTextFile ("\\myserver\netlogon\list.txt")
    readlines
    end if

    function readlines()
    do until list.atendofstream
    listline=list.readline
    intval=0
    for counter=1 to len(listline)
    if mid(listline,counter,1)=":" then
    intval=intval+1
    end if
    next
    if intval=1 then

    comname=""
    printerpath=""
    intval = 0
    for counter=1 to len(listline)
    if mid(listline,counter,1) = ":" then
    intval=1
    counter=counter+1
    end if
    if intval=0 then
    comname=comname & mid(listline,counter,1)
    end if
    if intval=1 then
    printerpath=printerpath & mid(listline,counter,1)
    end if
    next


    if mid(comname,len(comname),1)="*" then

    comname=mid(comname,1,len(comname)-1)
    comname=ucase(Comname)

    if mid(networkaccess.computername,1,len(comname))=com name then

    on error resume next
    networkaccess.AddWindowsprinterconnection printerpath
    end if
    else

    if networkaccess.computername = comname then
    on error resume next
    networkaccess.AddWindowsprinterconnection printerpath
    end if

    end if
    else

    end if
    loop

    end function
    function exitpro()
    msgbox "Printer: " & printerpath & " is not available, please check the path in the connection list or hardware status of the printer.",,"Printer connection fail"
    end function

  2. #17

    Join Date
    Feb 2011
    Posts
    82
    Thank Post
    1
    Thanked 5 Times in 4 Posts
    Rep Power
    7
    In the .txt file you specify the computer names or the beggining of the computer names followed by a star if you want all computers beginning with the same name to have the printers applied.

    So if you had a room of computers called for example : ART01,ART02,ART03 etc... To apply the printers you would simply put Art* and that would apply the required printers to all the Art computers. Hope that makes sense.

    Art*:\\myprintserver\Design Colour Laser
    Art*:\\myprintserver\Textiles Colour Laser
    biology*:\\myprintserver\Design Mono Laser
    bio*:\\myprintserver\Design Colour Laser
    bio*:\\myprintserver\Design Mono Laser
    chemistry*:\\myprintserver\Design Mono Laser
    chemistry*:\\myprintserver\Design Colour Laser
    eng*:\\myprintserver\Gallery Mono Laser
    eng*:\\myprintserver\Gallery Colour Laser
    eng*\\englishsb\English Mono Laser
    exam*:\\myprintserver\ICT1 Mono Laser
    drama*:\\myprintserver\Music Mono Laser

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Print Management - Clients cannot print
    By Gatt in forum Windows Server 2008 R2
    Replies: 2
    Last Post: 31st October 2010, 04:12 PM
  2. Replies: 13
    Last Post: 30th June 2009, 04:23 PM
  3. Print Green - Free Print Waste Management Software
    By sandeep2504 in forum Downloads
    Replies: 1
    Last Post: 26th June 2009, 12:56 PM
  4. R2 Print Management - Per Computer
    By Michael in forum Windows
    Replies: 3
    Last Post: 13th March 2009, 12:39 PM
  5. Print Management & GPO Printer Installs
    By RobC in forum Windows Vista
    Replies: 1
    Last Post: 7th July 2006, 09:42 PM

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
  •