Solved

User Account Information in vb.net

Posted on 2011-02-23
4
514 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Viewers will learn the basics of creating custom device Racks in Ableton Live. Place instrument(s) and effects onto a track, and select them all by holding the Shift key and clicking on the device title bars: Group them by typing Command-G (Ctrl-G…
Viewers will learn how to use Macros for greater control over Rack parameters in Ableton Live. Group devices into a Rack by selecting them and pressing Command-G (Ctrl-G on PC): Control-click (Right Click on PC) a parameter to access pop-up menu, …

856 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