the dotnet world is so beautiful.
enjoy the code below
public function valuesepr(byval rawstring as string, byval sepchar as string) as string
if instr(1, rawstring, sepchar) <> 0 then
valuesepr = microsoft.visualbasic.right(rawstring, len(rawstring) – instr(1, rawstring, sepchar))
else
valuesepr = rawstring
end if
end function
public function getmac(byval ip as string) as string
try
dim dirresults as string
dim psi as processstartinfo = new processstartinfo()
dim proc as new process()
psi.filename = "nbtstat"
psi.redirectstandardinput = false
psi.redirectstandardoutput = true
psi.arguments = "-a " & ip
psi.useshellexecute = false
proc = process.start(psi)
dim x as integer = -1
do until x > -1
if dirresults <> nothing then
x = dirresults.trim.tolower.indexof("mac address", 0)
if x > -1 then
exit do
end if
end if
dirresults = proc.standardoutput.readline
loop
proc.waitforexit()
getmac = valuesepr(dirresults.trim, "=").trim
catch err as exception
msgbox(err.message & err.stacktrace)
end try
end function
