Results 1 to 3 of 3

Thread: Get all users of windows

  1. #1

    Thread Starter
    New Member Xscapism's Avatar
    Join Date
    Aug 2010
    Posts
    9

    Get all users of windows

    Hi !

    How can I get all 'local' users of windows ?

    I know how to get the currently logged in username, but don't know how to get a list of all the users.

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Get all users of windows

    From http://www.freevbcode.com/ShowCode.Asp?ID=5147
    VB Code:
    1. ' ****************************************************************************
    2. ' List all users and some of their properties in a Windows 2000 AD domain or
    3. ' Windows NT4 domain. If domain is a computer, all users of the local SAM
    4. ' database are displayed.
    5. ' ****************************************************************************
    6. ' Goto http://www.activxperts.com/activmonitor and click on ADSI Samples
    7. ' for more samples
    8. ' ****************************************************************************
    9.  
    10. Sub ListUsers( strDomain )
    11.     Set objComputer = GetObject("WinNT://" & strDomain )
    12.     objComputer.Filter = Array( "User" )
    13.     For Each objUser In objComputer
    14.         WScript.Echo "Name: " & objUser.Name
    15.         WScript.Echo "Fullname: " & objUser.Fullname
    16.         WScript.Echo "Description: " & objUser.Description
    17.         WScript.Echo "AccountDisabled: " & objUser.AccountDisabled
    18.         WScript.Echo "IsAccountLocked: " & objUser.IsAccountLocked
    19.         WScript.Echo "Profile: " & objUser.Profile
    20.         WScript.Echo "LoginScript: " & objUser.LoginScript
    21.         WScript.Echo "HomeDirectory: " & objUser.HomeDirectory
    22.         WScript.Echo ""
    23.    
    24.     Next
    25. End Sub
    26.  
    27.  
    28. ' ****************************************************************************
    29. ' Main
    30. ' ****************************************************************************
    31. Dim strDomain
    32. Do
    33.    strDomain = inputbox( "Please enter a domainname", "Input" )
    34. Loop until strDomain <> ""
    35.  
    36. ListUsers( strDomain )
    37.  
    38.  
    39. WScript.Echo( vbCrlf & "For more samples, goto http://www.activxperts.com/activmonitor and click" )
    40. WScript.Echo( "on ADSI samples" )
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Get all users of windows

    That is vbscript not VB.NET ahbijit

    Here's a VB.NET example I wrote a while ago: http://www.vbforums.com/showthread.php?t=590129
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width