加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

使用ASP获取服务器网卡的MAC地址信息

发布时间:2023-09-07 14:30:02 所属栏目:Asp教程 来源:
导读:'----------------------提取所有网卡的信息--------------------'

Public Function GetMacInfo()

On Error Resume Next

Dim fso, FileStr, AspSleepThread, CmdStr, SysDir, wshshell,
'----------------------提取所有网卡的信息--------------------'
 
Public Function GetMacInfo()
 
    On Error Resume Next
 
    Dim fso, FileStr, AspSleepThread, CmdStr, SysDir, wshshell, CmdRe, MacFileContentFile, MacFileContent
 
    Const MacFile = "TmpYesoulSoft001.LLP"
 
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
 
    SysDir = Split(GlobalMod.GetSysDir, ",")(1)
 
            If InStr(LCase(SysDir), "system32") = 0 Then
 
            GetMacInfo = "本系统只能运行在Nt、Windows 2000、Windows.Net、Windows Xp、Windows 2003等32位系统下,不支持32位以下的系统!"
 
            Exit Function
 
            Else
 
            CmdStr = SysDir + "/Cmd.exe /C " + SysDir + "/Ipconfig.exe /All > " + Server.MapPath(MacFile)
 
            End If
 
        CmdRe = Shell(CmdStr, vbHide)
 
        If CmdRe <> 0 Then
 
        Set MacFileContentFile = fso.OpenTextFile(Server.MapPath(MacFile), 1, False, TristateUseDefault)
 
        'GetMacInfo = MacFileContentFile.ReadAll()
 
        'Response.Flush
 
        FileStr = MacFileContentFile.ReadAll()
 
        MacFileContentFile.Close
 
        Set MacFileContentFile = Nothing
 
        Set AspSleepThread = Server.CreateObject("YesoulSoft.SleepThread")
 
        '定义线程挂起的时间,这里为毫秒
 
        AspSleepThread.SleepTime = 500
 
        AspSleepThread.BeginSleepThread
 
        GetMacInfo = ExecuteOne(FileStr, "Physical Address. . . . . . . . . : (.*)")
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章