Io uso l'API di Windows GetComputerName

codice:
Public Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Sub Form_Load()
     if ComputerName="Sconosciuto" then
          'istruzioni
     end if
End Sub

Public Function ComputerName() As String
    'Restituisce il nome della macchina
    Dim SBuffer As String * 255
    
    If GetComputerName(SBuffer, 255&) <> 0 Then
        ComputerName = Left$(SBuffer, InStr(SBuffer, vbNullChar) - 1)
    Else
        ComputerName = "Sconosciuto"
    End If
End Function