Can anyone help me please, I currently have a vb.net app that has an SQL database running on a companies server. I am currently trying to get the MAC address of the server using the below code. This code works fine for a networked computer but not for the server (I guess because it has additional security, which would make sense). Can anyone advise me on a better way to get this info or how I can solve my original code.

Note: I don't want to use a stored procedure (if this is possible) as people are able to tamper, and this is used for licensing of my app.

VB Code:
  1. ' this is the hostname of the server
  2. dim hostName as string = "server0001"
  3.  
  4. Try
  5.                 Dim cls As New ManagementClass("\\" & hostName & "\root\cimv2", "Win32_NetworkAdapter", _
  6.                     New ObjectGetOptions(Nothing, TimeSpan.MaxValue, False))
  7.                 Dim col As Object
  8.                 col = cls.GetInstances()
  9.  
  10.                 Dim obj As ManagementObject
  11.                 For Each obj In col
  12.                     If Not obj.Properties("MACAddress").Value Is Nothing Then
  13.                         msgbox(obj.Properties("MACAddress").Value.ToString().Replace(":", "-"))
  14.                     End If
  15.                 Next
  16.             Catch ex As Exception
  17.                 msgbox(ex.Message)
  18.             End Try

Thanks in advance

Simon