Thursday, 22 August 2013

VB or Batch script to get the MAC address of remote windows CE devices

VB or Batch script to get the MAC address of remote windows CE devices

I'm trying to write a script in vb to open a telnet session to a remote
windows CE7 device from a Windows 7 laptop to get the output from ipconfig
/all to a text file, then append the contents of that text file to a log.
So far I've only been able to do this by running the vb script, then
running an ftp script to retrieve the log from the device. I haven't
figured out how to get that file's contents copied into a main log file.
This is my vb script:
Set OBJECT = CreateObject("WScript.Shell")
OBJECT.run"cmd"
WScript.Sleep 800
OBJECT.SendKeys"telnet ipaddress"
OBJECT.SendKeys("{Enter}")
WScript.Sleep 800
OBJECT.SendKeys"admin"
OBJECT.SendKeys("{Enter}")
WScript.Sleep 800
OBJECT.SendKeys"admin"
OBJECT.SendKeys("{Enter}")
WScript.Sleep 800
OBJECT.SendKeys"ipconfig /all >> somelog.log"
OBJECT.SendKeys("{Enter}")
WScript.Sleep 800
OBJECT.SendKeys"^]"
WScript.Sleep 800
OBJECT.SendKeys"quit"
OBJECT.SendKeys("{Enter}")
WScript.Sleep 800
OBJECT.SendKeys"exit"
OBJECT.SendKeys("{Enter}")I then run a batch file that runs an ftp file:

open 172.16.24.45
admin
admin
get "sendkeys.log"
close
I'd love to automate this entire process and get it done with 1 file. Any
help is greatly appreciated.

No comments:

Post a Comment