• 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
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    DOS question

    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?

    #2
    Yes.

    Comment


      #3
      Originally posted by angusglover
      Yes.
      And that would be how?

      Comment


        #4
        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.mspx

        Comment


          #5
          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

          Comment


            #6
            Originally posted by xondo
            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.

            Comment

            Working...
            X