PDA

View Full Version : DOS question



XTC
20th June 2007, 09:08
I want to send printer paths i.e \\servername\printername to a text file. i can do this for drive mapping i.e net use > c:\mappings.txt can I do this for printers?

angusglover
20th June 2007, 09:10
Yes.

XTC
20th June 2007, 09:11
Yes.

And that would be how?

weboo
20th June 2007, 11:16
Only if you map to an LPT port will it work. Net use will display mappings, and as most printers these days are not mapped...they are via IP / unc

PSTools might do it though: http://www.microsoft.com/technet/sysinternals/utilities/PsTools.mspx

xondo
20th June 2007, 11:44
Use this script

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oPrinters.Count - 1 Step 2
WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)

Save to a text file e.g. ptrt.vbs then run

cscript prt.vbs >ptr.txt

XTC
22nd June 2007, 13:12
Use this script

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oPrinters.Count - 1 Step 2
WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)

Save to a text file e.g. ptrt.vbs then run

cscript prt.vbs >ptr.txt

Great thanks mate.