Function GetMAC(strIP)
Set net = Server.CreateObject("wscript.network")
Set sh = Server.CreateObject("wscript.shell")
TempPath="c:\temp\" '临时目录
sh.run "%comspec% /c nbtstat -A " & strIP & " > " &TempPath&strIP & ".txt",0,true
Set sh = nothing
Set fso = createobject("scripting.filesystemobject")
Set ts = fso.opentextfile(TempPath&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 TempPath&strIP & ".txt"
Set fso = nothing
GetMAC = macaddress
End Function
%>
< HTML>
< HEAD>
< TITLE>Say Hello To the MAC MAN</TITLE>
< /HEAD>
< BODY>
< %Response.Write("I P:" & strIP & "" & vbcrlf &"<p>")%>
< %Response.Write("MAC:" & strMac & vbcrlf)%>
< /BODY>
< /HTML>