I want to get the current computer name.
this is my code:
Public Function GetComputerName() As String
Dim ComputerName As String
ComputerName = System.Net.Dns.GetHostName
Return ComputerName
End Function
this code working, but i remember that there is faster way.
what is the fast way to get the computer name?
Duplicate Machine NamesAD Bridge supports duplicate computer names by generating a new hashed computer name during the join process for subsequent conflicting computer names. The generated name will consist of the first seven characters from the original name, a hyphen, and then a unique seven digit code.
Use nbtstat -n in a command window to see which name is in the Conflict state. (eventvwr: Another machine has sent a name release message to this machine probably because a duplicate name has been detected on the TCP network. The IP address of the node that sent the message is in the data.
Click on the Start button. Right-click on Computer. Select Properties. Under Computer name, domain, and workgroup settings you will find the computer name listed.
you can just use without function:
System.Net.Dns.GetHostName
or:
Environment.MachineName
This is not that good the previous anwser,but if you love to work with forms:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Text = System.Windows.Forms.SystemInformation.ComputerName
End Sub
System.Windows.Forms.SystemInformation gives a lot of nice informations.
-> UserDomainName
-> UserName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With