File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -34,17 +34,20 @@ Module Helper
34
34
35
35
36
36
Function getUID() As String
37
-
38
37
Dim MacID As String = String .Empty
39
38
Dim mc As ManagementClass = New ManagementClass( "Win32_NetworkAdapterConfiguration" )
40
39
Dim moc As ManagementObjectCollection = mc.GetInstances()
41
40
For Each mo As ManagementObject In moc
42
- If (MacID = String .Empty And CBool (mo.Properties( "IPEnabled" ).Value) = True ) Then
43
- MacID = mo.Properties( "MacAddress" ).Value.ToString()
41
+
42
+ If mo.Properties( "IPEnabled" ) IsNot Nothing AndAlso mo.Properties( "IPEnabled" ).Value IsNot Nothing Then
43
+
44
+ If CBool (mo.Properties( "IPEnabled" ).Value) = True AndAlso mo.Properties( "MacAddress" ) IsNot Nothing AndAlso mo.Properties( "MacAddress" ).Value IsNot Nothing Then
45
+ MacID = mo.Properties( "MacAddress" ).Value.ToString()
46
+ Exit For
47
+ End If
44
48
End If
45
49
Next
46
50
Return Convert.ToBase64String(Encoding.UTF8.GetBytes(MacID))
47
-
48
51
End Function
49
52
50
53
You can’t perform that action at this time.
0 commit comments