List All User Accounts
Page 1 of 1 • Share •
List All User Accounts
This will return a list of all users in a computer.
Make sure to have "Imports System.Management" at the beginning of any code file this is in.
If you need to, add a reference to System.Management.dll
WARNING: Hidden users such as Guest and Administrator and other miscellaneous accounts my be in your computer.
CODE
Private Function AllUsers() As String()
Dim R As New List(Of String)
Dim query As New SelectQuery("Win32_UserAccount")
Dim searcher As New ManagementObjectSearcher(query)
For Each envVar As ManagementObject In searcher.Get()
R.Add(envVar("Name"))
Next
Return R.ToArray
End Function
Make sure to have "Imports System.Management" at the beginning of any code file this is in.
If you need to, add a reference to System.Management.dll
WARNING: Hidden users such as Guest and Administrator and other miscellaneous accounts my be in your computer.
CODE
Private Function AllUsers() As String()
Dim R As New List(Of String)
Dim query As New SelectQuery("Win32_UserAccount")
Dim searcher As New ManagementObjectSearcher(query)
For Each envVar As ManagementObject In searcher.Get()
R.Add(envVar("Name"))
Next
Return R.ToArray
End Function
conorsteel- Admin

- Number of posts: 13
Age: 16
Location: Kilmarnock, Scotland
Registration date: 2008-08-31

Permissions of this forum:
You cannot reply to topics in this forum





