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?
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
DOS question
Collapse
X
-
-
-
-
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/sys...s/PsTools.mspxComment
-
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.txtComment
-
Great thanks mate.Originally posted by xondoUse 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.txtComment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Contractors, Joint & Several Liability’s unintended consequences are already piling up Today 07:29
- Contractors, did you know self-employed DBS Checks have changed, for the better? Yesterday 07:56
- Offshoring harms already fraught IT contractors. Here’s what ministers can do Mar 16 07:57
- Dividends in 2026/27: an expert’s explainer for contractors Mar 13 07:20
- Dividends in 2026/27: an expert’s explainer for contractors Mar 13 07:04
- Contracting Awards 2026 opens for entries — with new AI category Mar 12 07:26
- Contracting Awards 2026 opens for entries — with new AI category Mar 12 07:26
- Contractors, beware these four traps in the UK’s Statutory Residence Test Mar 11 08:18
- Contractors, beware these four traps in the UK’s Statutory Residence Test Mar 11 00:23
- ‘Stable’ IT contractor demand moved near growth in February 2026 Mar 10 07:16

Comment