MacAddress network card

  • if you want, you can write a parser for

    exec master..xp_cmdshell 'ipconfig /all'

    Steve Jones

    steve@dkranch.net

  • I've been looking, and I am not seeing any other solution other than dropping to command shell, either with ipconfig /all or nbtstat -a <hostname>.

    For instance:

    
    
    DECLARE @SQL nvarchar(27)
    SET @SQL = 'nbtstat -a ' + @@SERVERNAME
    
    
    CREATE TABLE #CmdShellDump (
    ShellLine varchar(80))
    
    
    INSERT #CmdShellDump
    EXEC master.dbo.xp_cmdshell @SQL
    
    
    SELECT RTRIM(LTRIM(RIGHT(ShellLine, LEN(ShellLine) - CHARINDEX('=', ShellLine))))
    FROM #CmdShellDump
    WHERE CHARINDEX('MAC Address', ShellLine) > 0
    
    
    DROP TABLE #CmdShellDump

    K. Brian Kelley

    bkelley@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

  • That seems to be the only way from the SQL side. But as long as you only have one nic there really is no worry. However I don't know if I would wast the overhead of doing this everytime a user comes in. If you have only one NIC then put this data in whatever table you are using to store as the default for the column. If you have a load balanced system using more than one nic you may have to write an external piece. Now since I don't have a server in front of me, can you get the local ip address or connecion they came in own? If so then you create a table with the mac for each ip listing and pull it. But since a mac address never changes unless you change nics I don't suggest quering for it each time a connections occurrs.

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply