28,391
社区成员
发帖
与我相关
我的任务
分享
function getClientMac(strIp)
dim net,sh,fso,ts,data,macaddress
Set net = Server.CreateObject("wscript.network")
Set sh = Server.CreateObject("wscript.shell")
sh.run "%comspec% /c nbtstat -A " & strIP & " > d:\ipmac\" & strIP & ".txt",0,true
Set sh = nothing
Set fso = createobject("scripting.filesystemobject")
Set ts = fso.opentextfile("d:\ipmac\" & strIP & ".txt")
macaddress = null
Do While Not ts.AtEndOfStream
data = ucase(trim(ts.readline))
If instr(data,"MAC ADDRESS") Then
macaddress = trim(split(data,"=")(1))
Exit Do
End If
loop
ts.close
Set ts = nothing
'fso.deletefile "d:" & strIP & ".txt"
Set fso = nothing
getClientMac = macaddress
' getClientMac = "SSSSSSS"
end function