Question : Enumerate printers on a print server

Hi

 I am looking for a VB script which will export the list of printers on a print server to a excel file in the following format.

Printer share name, printer IP address,Driver installed, location.

Answer : Enumerate printers on a print server

Hi, this is the answer to your question ?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery ("Select * from Win32_Printer")
 
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Printer share name"
objExcel.Cells(1, 2).Value = "printer IP address"
objExcel.Cells(1, 3).Value = "Driver installed"
objExcel.Cells(1, 4).Value = "location"
x = 2
 
For Each objPrinter in colInstalledPrinters
    'Wscript.Echo "Name: " & objPrinter.ShareName
    'Wscript.Echo "Location: " & objPrinter.PortName
    'Wscript.Echo "Default: " & objPrinter.DriverName
    'Wscript.Echo "Default: " & objPrinter.Location
    
    objExcel.Cells(x, 1).Value = objPrinter.ShareName
    objExcel.Cells(x, 2).Value = objPrinter.PortName
    objExcel.Cells(x, 3).Value = objPrinter.DriverName
    objExcel.Cells(x, 4).Value = objPrinter.Location
    x = x + 1
Next
 
Set objRange = objExcel.Range("A1")
objRange.Activate
 
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
 
Set objRange = objExcel.Range("B1")
objRange.Activate
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
 
Set objRange = objExcel.Range("C1")
objRange.Activate
 
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
 
Set objRange = objExcel.Range("D1")
objRange.Activate
 
Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Autofit()
Random Solutions  
 
programming4us programming4us