|
-
Aug 13th, 2010, 07:19 AM
#1
Thread Starter
New Member
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.
-
Aug 13th, 2010, 08:47 AM
#2
Re: Get all users of windows
From http://www.freevbcode.com/ShowCode.Asp?ID=5147
VB Code:
' ****************************************************************************
' List all users and some of their properties in a Windows 2000 AD domain or
' Windows NT4 domain. If domain is a computer, all users of the local SAM
' database are displayed.
' ****************************************************************************
' Goto http://www.activxperts.com/activmonitor and click on ADSI Samples
' for more samples
' ****************************************************************************
Sub ListUsers( strDomain )
Set objComputer = GetObject("WinNT://" & strDomain )
objComputer.Filter = Array( "User" )
For Each objUser In objComputer
WScript.Echo "Name: " & objUser.Name
WScript.Echo "Fullname: " & objUser.Fullname
WScript.Echo "Description: " & objUser.Description
WScript.Echo "AccountDisabled: " & objUser.AccountDisabled
WScript.Echo "IsAccountLocked: " & objUser.IsAccountLocked
WScript.Echo "Profile: " & objUser.Profile
WScript.Echo "LoginScript: " & objUser.LoginScript
WScript.Echo "HomeDirectory: " & objUser.HomeDirectory
WScript.Echo ""
Next
End Sub
' ****************************************************************************
' Main
' ****************************************************************************
Dim strDomain
Do
strDomain = inputbox( "Please enter a domainname", "Input" )
Loop until strDomain <> ""
ListUsers( strDomain )
WScript.Echo( vbCrlf & "For more samples, goto http://www.activxperts.com/activmonitor and click" )
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
-
Aug 13th, 2010, 04:33 PM
#3
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|