title: prnmngr.vbs - parse and format output as csv from a windows batch file?
body: <pre><code>@ECHO OFF
  setlocal enabledelayedexpansion
  for /f "tokens=*" %%f in ('Cscript %WINDIR%\\System32\\Printing_Admin_Scripts\\en-US\\Prnmngr.vbs -l -s myserver1.com') do (
    echo %%f
  )
  pause
  </code></pre>
  
  <p>output looks like  :</p>
  
  <pre><code>Server name myserver1.com
  Printer name myprinter1
  Share name myprinter1
  Driver name SHARP UD2 PCL6
  Port name myprinter1.com
  Comment
  Location
  Print processor winprint
  Data type RAW
  Parameters
  Attributes 584
  Priority 1
  Default priority 0
  Average pages per minute 0
  Printer status Idle
  Extended printer status Unknown
  Detected error state Unknown
  Extended detected error state Unknown
  </code></pre>
  
  <p>and so on for 100 printers</p>
  
  <p>output expected in a csv file is the <strong>server name</strong>, <strong>printer name</strong> <strong>share name</strong>, <strong>driver name</strong>, <strong>port name</strong> as shown below:</p>
  
  <pre><code>myserver1.com,myprinter1,myprinter1,SHARP UD2 PCL6,myprinter1.com
  myserver2.com,myprinter2,myprinter2,hp  PCL6,myprinter2.com
  myserver3.com,myprinter3,myprinter3,hp universal PCL5,myprinter3.com
  </code></pre>
  
  <p>Please suggest</p>