Reputation: 89
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = System.Windows.Forms.SystemInformation.ComputerName
Label2.Text = System.DirectoryServices.AccountManagement
Label3.Text = System.Windows.Forms.SystemInformation.UserName
End Sub
End Class
As shown above is the code that is currently working. I'm trying to display three things, Computer name, local user's full name and the user's username. I've got the former and latter working but not the full name. I cannot use AD.
Any help would be massively appreciated once again! Many thanks
Upvotes: 0
Views: 181
Reputation: 1425
I'm sure if by "I cannot use AD" you mean that you just cannot use an LDAP query. That being the case you could try
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName
End Sub
End Class
Keep in mind that you will need to add a reference in your project to System.DirectoryServices.AccountManagment
Upvotes: 1