How I can get a list of active users and their profiles (access rights) to O.S. in Windows Server 2003 ?
1 Answers
It depends on what you mean by "active" and by "profiles" and by "access rights". It also depends on whether you are interested in local users or domain users.
For local users, you can use net user
at a command prompt.
C:\Users\MyUser>net user
User accounts for \\TestMachine
-------------------------------------------------------------------------------
DefaultAccount defaultuser0 Administrator
JohnSmith SallyJones MyUser
To tell whether each one is active (and in this case, Windows uses "active" to mean "enabled" -- it has nothing to do with whether they are currently logged on, or when they most recently interacted with the system), you can use net user <username>
.
C:\Users\MyUser>net user administrator
User name administrator
Full Name administrator
Comment Administrator Account
User's comment
Country/region code 000 (System Default)
Account active No
Account expires Never
[...]
Local Group Memberships *Administrators *Performance Log Users
[...]
The command completed successfully.
And then you can parse out the "Account active" portion. But Powershell makes it easier.
Get-LocalUser
That'll give you all local users. To filter for only active (enabled) users:
Get-LocalUser | Where Enabled -eq "True"
As for access rights (that's not the same thing as a profile, but I'm gonna assume you are looking for access rights), the net user <username>
command will give you a list of the local groups that the user is a member of. (But finding exactly what object those groups (or the users directly) have access to will require looping through all securable objects.)
If you can clarify what it is that you are trying to accomplish, this answer can probably be improved.

- 1,844
- 7
- 10