For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > August 2005 > find printer list in vbscript









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author find printer list in vbscript
stabilo

2005-08-26, 6:55 pm

I'm using vbscript and XP prof.
I need to list the all the Print queues of our print servers, including the
printers shared by computer. In otherwords I need to have a list of all
printers avaiable in my network.
I have been using the following lines :

Set c = getobject("WinNT://servername,computer")
c.filter = array("Printqueue")
n=0

afile = "D:\output.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(afile, True)

For each p in c
n = n + 1
Set pq = getobject(p.ADspath)
MyFile.WriteLine ("Print Queue " & Cstr(n) & ": " & pq.name & " " &
"Location : " &pq.location)
next

Myfile.close
Msgbox "Done"

This code will write in a text file the queues of my server servername, but
only for this specific server name and does not inlcude the printers shared
by computers.

How to do it ?

I'd like to have the same list than the Find Printer dislog box when I do
not specified anyt criterias.
Jeff Johnson [MVP: VB]

2005-08-26, 6:55 pm


"stabilo" <stabilo@discussions.microsoft.com> wrote in message
news:4C7FD471-AE20-43BE-AD55-B31B954550A6@microsoft.com...

> I'm using vbscript and XP prof.


Then you'll probably get better answers in
microsoft.public.scripting.vbscript. This group is for the full-blown VB
language.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com