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.
Thanks in advance
Simon
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.NET:
' this is the hostname of the server
dim hostName as string = "server0001"
Try
Dim cls As New ManagementClass("\\" & hostName & "\root\cimv2", "Win32_NetworkAdapter", _
New ObjectGetOptions(Nothing, TimeSpan.MaxValue, False))
Dim col As Object
col = cls.GetInstances()
Dim obj As ManagementObject
For Each obj In col
If Not obj.Properties("MACAddress").Value Is Nothing Then
msgbox(obj.Properties("MACAddress").Value.ToString().Replace(":", "-"))
End If
Next
Catch ex As Exception
msgbox(ex.Message)
End Try
Simon