sql-servermac-addresswindows-serverwindows-server-2000

How to get the MAC-address from MSSQL server 2000


I'm currently working on a project where I (among other things) need to find the MAC address for a remote computer. The problem is that i'm restriced to only accessing the computer throught SQL queries. (so I can't use WMI)

The remote computer is running Windows Server 2000, and Ms SQL server 2000.

I know the IP of the remote computer and I am able to log in with the admin account. How can I get the MAC address(preferably all of them) from the remote computer?

Thankful for answers.


Solution

  • I solved it for my computer

    //dont mind the makeQuery and querySrv

    ResultTable res = makeQuery(querySrv,("USE Master; EXEC xp_regread 'HKEY_LOCAL_MACHINE', 'SOFTWARE\\Description\\Microsoft\\rpc\\UuidTemporaryData', 'NetworkAddress'"));
        byte[] bMac =(byte[])res.getRow(0).data[1];
        String mac = String.format("%02X:%02X:%02X:%02X:%02X:%02X", bMac[0], bMac[1], bMac[2], bMac[3], bMac[4], bMac[5]);
    

    This should work for other windows server 2000 servers

    Thanks to @morgano for help with the formating and byte/hex converting