title: Telnet router via batch, get info and export to csv file
body: <p>I set up a small 3 router network via GNS3. I can connect on it via my pc (telnet) and execute simple cisco commands like show int brief.
  Now I found a batch file here that I modified a little to login all 3 routers and execute the show ip int brief command. I have all the info on my screen, but I would like to have it in a .csv file. </p>
  
  <p>I changed the router IP's
  R1: 1.1.1.1, R2: 2.2.2.2, R3: 3.3.3.3</p>
  
  <p>This is the batch-file</p>
  
  <pre><code>:: Open a Telnet window
  start telnet.exe 1.1.1.1             
  :: Run the script
  cscript showipintbrief.vbs
  </code></pre>
  
  <p>This is the vbs file (showipintbrief.vbs):</p>
  
  <pre><code>set OBJECT=WScript.CreateObject("WScript.Shell")
  WScript.sleep 50
  OBJECT.SendKeys "loginR1password{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "enable{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "enableR1password{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "show ip int brief{ENTER}"
  WScript.sleep 50
  Echo Interface, IP-Address &gt; showipintbrief.csv
  OBJECT.SendKeys "telnet 2.2.2.2{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "loginR2password{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "enable{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "enableR2password{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "show ip int brief{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "telnet 3.3.3.3{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "loginR3password{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "enable{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "enableR3password{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "show ip int brief{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "exit{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "exit{ENTER}"
  WScript.sleep 50
  OBJECT.SendKeys "exit{ENTER}"
  </code></pre>
  
  <p>For instance Interface, Ip-address, status and protocol should be sent to a .csv file</p>
  
  <p>Anyone can help wiht this please?
  Thanks a lot</p>