Solved

User Account Information in vb.net

Posted on 2011-02-23
4
510 Views
Last Modified: 2013-12-07
How to get user accounts information i.e. user name, password,domain,groups (whether administratiors or others,etc.)
of the computer using vb.net

please help, its very urgent...
0
Comment
Question by:gopalhazel
  • 3
4 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 34967719
Retrieving password of windows: luckily not possible :)

With AD:
*  you can use WindowsPrincipal.IsInRole() to check if the user belongs to a specific group:
    http://msdn.microsoft.com/en-us/library/fs485fwh.aspx
*  http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.userprincipal.getauthorizationgroups.aspx

Retrieve current Windows user information using VB.NET
http://www.techrepublic.com/article/retrieve-current-windows-user-information-using-vbnet/6115410


Working with Active Directory in VB.NET
http://www.codeproject.com/KB/system/active_directory_in_vbnet.aspx
0
 

Author Comment

by:gopalhazel
ID: 34968803
can anubody give me the sample code or example to get the user accounts information of the computer using vb.net..
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 34968831
Get Current Username in VB.NET
http://www.developerfusion.com/code/4409/get-current-username-in-vbnet/
Declare Function GetUserName Lib "advapi32.dll" Alias _ 
       "GetUserNameA" (ByVal lpBuffer As String, _ 
       ByRef nSize As Integer) As Integer 

   Public Function GetUserName() As String 
       Dim iReturn As Integer 
       Dim userName As String 
       userName = New String(CChar(" "), 50) 
       iReturn = GetUserName(userName, 50) 
       GetUserName = userName.Substring(0, userName.IndexOf(Chr(0))) 
   End Function

Open in new window

0
 
LVL 53

Expert Comment

by:Dhaest
ID: 34968835
Get the current user's name in Visual Basic .NET
http://www.vb-helper.com/howto_net_get_user_name.html
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
    e As System.EventArgs) Handles MyBase.Load
    lblUserName.Text = SystemInformation.UserName
End Sub

Open in new window

0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Viewers will learn the basics of making and using Impulse Kits in Ableton Live. Load new Impulse into an empty MIDI track: Fill the 8 empty sample slots with drum samples: Adjust parameters to tailor each sound as desired: Proceed to create be…
Viewers will learn key ranges in Sampler to make their sampled instruments sound more realistic Gather samples of various notes and drag them to Key Range panel: Set proper root key for each sample: Select all the samples with Command-A (or Ctrl…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question