Computing.Net > Forums > Programming > Display a list of users on the local machine

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Display a list of users on the local machine

Reply to Message Icon

Name: scrfix
Date: May 3, 2009 at 06:38:28 Pacific
OS: Windows XP and Vista
CPU/Ram: 4 Gigabytes
Product: Any pc / Any model
Subcategory: Batch
Comment:

Easy Question:
Is there a way to display a list of non currently active user profile names on the local machine? (By non currently active, I mean to display a list of all of the profile names leaving out the one I am running the batch file from and all of the system profiles like the default or all users profile.)
Example:
1. There are 5 profiles on a Windows XP or Vista Computer. (ie. Tina, Tony, Wayne, Owner, Thomas).
2. Currently using and running the batch file from Owner.
3. Currently logged in are also the profiles Tina and Tony. (We are in switch user mode using Owner)

I would like to capture and store in multiple separate variables that Tina, Tony, Wayne and Thomas are also profiles on the computer. I would also like to capture if the computer adds any profiles later on in the future such as Randy.

Is there a way to do this? I have been searching all over the place for a command and I cannot find one.

I know that for XP, I can probably look into the documents and settings folder, get a dir listing and then subtract out all of the default names and the currently logged in name however I was hoping for something more simple.

Any thoughts?

Thanks,

Wayne



Sponsored Link
Ads by Google

Response Number 1
Name: scrfix
Date: May 3, 2009 at 17:06:31 Pacific
Reply:

I found this on experts exchange. I figure I can modify this to fit my needs. I was just hoping there was an easier way then listing everything and then subtracting but I believe this will work. I modified this a little for Vista. The one I found was for XP.

@echo off
for /f "tokens=*" %%a in ('dir c:\users\ /b /ad') do call :process "%%a"
goto :eof

:process
if [%1]==["Administrator"] goto :eof
if [%1]==["All Users"] goto :eof
if [%1]==["Default User"] goto :eof
if [%1]==["LocalService"] goto :eof
if [%1]==["NetworkService"] goto :eof

cd\users
@pause
:eof


0
Reply to Message Icon

Related Posts

See More


how to creat msi package ... .DAT files



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Display a list of users on the local machine

javascript equiv of index.php? www.computing.net/answers/programming/javascript-equiv-of-indexphp/12465.html

Adding a list of numbers www.computing.net/answers/programming/adding-a-list-of-numbers/17355.html

flow of traffic on the LAN www.computing.net/answers/programming/flow-of-traffic-on-the-lan/5813.html