dbguy2626
asked on
Export Printers to a list
All,
I have a windows 2000 machine that has about 200 printers installed on it. I would like to export the printer information from the machine to a spreadsheet. The printer name and IP address would be helpful, but really the printer name is all I need on the list. Please help. This is an urgent request since we are taking the printer server down for some maintance
I have a windows 2000 machine that has about 200 printers installed on it. I would like to export the printer information from the machine to a spreadsheet. The printer name and IP address would be helpful, but really the printer name is all I need on the list. Please help. This is an urgent request since we are taking the printer server down for some maintance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I tried to use the script above to accomplish the same task and all it did was display the IP address to the screen. The Txt file was empty. What can I add to the file to have it collect the shared printer's sharenames?
I also tried the script and the command line ... not sure what GW_Techno did but mine created the printer.txt file as advertized ...
Problem is, as GW_Techno observed, ONLY the IP address was captured and recorded ... sample of output below:
Description:
Host Address:
Name: IP_192.168.1.121
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.122
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.123
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.124
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.125
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
I suspect the SQL used is incomplete.
Could someone complete the script for me, please.
Problem is, as GW_Techno observed, ONLY the IP address was captured and recorded ... sample of output below:
Description:
Host Address:
Name: IP_192.168.1.121
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.122
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.123
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.124
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
Description:
Host Address:
Name: IP_192.168.1.125
Port Number:
Protocol:
SNMP Community:
SNMP Dev Index:
SNMP Enabled:
I suspect the SQL used is incomplete.
Could someone complete the script for me, please.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_Printer")
For Each objItem In colItems
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Printer: " & objItem.DeviceID
Wscript.Echo "Driver Name: " & objItem.DriverName
Wscript.Echo "Port Name: " & objItem.PortName
Wscript.Echo "ShareName: " & objItem.ShareName
Wscript.Echo "Location: " & objItem.Location
Wscript.Echo
Wscript.Echo
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_Printer")
For Each objItem In colItems
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Printer: " & objItem.DeviceID
Wscript.Echo "Driver Name: " & objItem.DriverName
Wscript.Echo "Port Name: " & objItem.PortName
Wscript.Echo "ShareName: " & objItem.ShareName
Wscript.Echo "Location: " & objItem.Location
Wscript.Echo
Wscript.Echo
Next
Thank you FORCECORP!
THAT was the correct answer!
THAT was the correct answer!
Thanks FORCECORP! That worked perfectly
This script was very useful to me today. Thanks to all who contributed!
Hello,
Thanks for the script, very useful and simple.
Here is a customized version that puts all on 1 line for each printer... easy to re-use in Excel (semicolon separated):
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_Printer")
For Each objItem In colItems
Wscript.Echo "Description:" & ";" & objItem.Description & ";" & "Printer:" & ";" & objItem.DeviceID & ";" & "Driver Name:" & ";" & objItem.DriverName & ";" & "Port Name:" & ";" & objItem.PortName & ";" & "ShareName:" & ";" & objItem.ShareName & ";" & "Location:" & ";" & objItem.Location
Next
Is there a way to retrieve also other information, like some settings (trays, duplex,...) ?
Cheers
Richard
Thanks for the script, very useful and simple.
Here is a customized version that puts all on 1 line for each printer... easy to re-use in Excel (semicolon separated):
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_Printer")
For Each objItem In colItems
Wscript.Echo "Description:" & ";" & objItem.Description & ";" & "Printer:" & ";" & objItem.DeviceID & ";" & "Driver Name:" & ";" & objItem.DriverName & ";" & "Port Name:" & ";" & objItem.PortName & ";" & "ShareName:" & ";" & objItem.ShareName & ";" & "Location:" & ";" & objItem.Location
Next
Is there a way to retrieve also other information, like some settings (trays, duplex,...) ?
Cheers
Richard
ASKER
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
Set colPorts = objWMIService.ExecQuery _
("Select * from Win32_TCPIPPrinterPort")
For Each objPort in colPorts
Wscript.Echo "Description: " & objPort.Description
Wscript.Echo "Host Address: " & objPort.HostAddress
Wscript.Echo "Name: " & objPort.Name
Wscript.Echo "Port Number: " & objPort.PortNumber
Wscript.Echo "Protocol: " & objPort.Protocol
Wscript.Echo "SNMP Community: " & objPort.SNMPCommunity
Wscript.Echo "SNMP Dev Index: " & objPort.SnMPDevIndex
Wscript.Echo "SNMP Enabled: " & objPort.SNMPEnabled
Next