There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
DOS/Other
Tag Cloud
access acer asus bios bsod computer crash drive driver drivers error ethernet excel freeze games gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard netgear network printer problem ram random registry router slow software sound trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless xbox
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/Other >
Solved: listing configured users of a computer XP and Vista

Reply  
Thread Tools
scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
30-Jun-2009, 03:05 AM #1
Solved: listing configured users of a computer XP and Vista
I have read through all of the commands I can find on these webites.

Is there no way to display all of the users on a stand alone computer?

I see ways to changes users passwords, I see ways to change the NT Security permissions of that user however is there no way to tell me what users are on the computer.

I have a way devised to tell me this already with a For loop. I am mainly curious if I can find out if I can get a list of users.

My main goal is to clean up the junk temp files and temporary internet files on users other than the main active user.

Such as if I utilize %temp%, this only does the active users temp files however if Susan, Dave and Richard P. Blemmings are also usernames on that computer, I would like to clean up their junk files as well without having to sign into their username.

I figure, I have to have a list of the usernames first, correct? So this brings me back to my original question. Is there an easier, more effecient method of detecting usernames on a computer other than the for loop I have?
__________________
Wayne Leiser, Spectacular Computer Repair Computer Repair, Computer Services
World Famous Gift Baskets: Gift Baskets
Resources LLC: Water Treatment Coagulation, Water Recycling
IMiteBable2help's Avatar
IMiteBable2help has a Photo Album
Computer Specs
Senior Member with 1,003 posts.
 
Join Date: Nov 2001
Location: 172 Miles S of Microsoft Corp
Experience: Advanced but no Expert
30-Jun-2009, 03:29 AM #2
So what's the issue? doesn't both XP and Vista boot to a login screen showing the user accounts? (if not, that can be changed)

You can see a list of all accounts in XP by going to control panel < computer management. Then, in the left window pane, under Local Users and Groups<users.

Note that there are several accounts in there with descriptions that are built-in to XP like Guest, ASPNET, help assistant, and support. Ignore those and what's left are created user accounts.

Alternatively, you might want to try this first: Right-click the My Computer icon on your desktop < System Properties, or get into System Properties another way, then click Advanced (tab) then User Profile settings. That will show the accounts, and even show how much space each account is using on the disk.

I don't know about Vista. Had it a few weeks and I hated it. Driver issues, incompatible apps, etc. Haven't used it since.
__________________
Ever notice how the lives we make never seem to get us anywhere but dead?*** My build: AMD Athlon64 X2 6400+Black Edition, Asus M2R32-MVP Mobo, Windows XP MCE, 2GB Dual-Channel DDR2-800 RAM, 512MB NVIDIA GeForce 8400 GS Graphics, WD 500GB SATA-2 HDD, Sony Multi-Recorder DVD-RW/DVD-RAM, PCI-HDTV Tuner, Monitor: 42" LCD 1080p 16:9
scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
30-Jun-2009, 04:17 AM #3
okay, apparently I wasn't clear enough.

I thought the command line reference would have given it away and the explanation about utilizing %temp%, a command line reference as well as cleaning up the temp files for other users, the FOR Loop mentioned or even the fact that this post is listed in DOS, PDA or Other but apparently I will still not clear enough...

Let me be a little more clear, this question is for scripting batch files. I am fully aware of how to get a list of users in the GUI many different ways.

I need to know if there is a command line reference that will return a list of currently configured users on a stand alone system. I saw one that can do a work group, domain from active directory and others but none that can return a list of users currently active on the computer. I say currently active because if a user does a dirty install (XP) where they do not format the computer they merely delete the windows directory then you are left with a list in documents and settings of the inactive users as well.

I currently have a script that I can modify that will allow me to clean up all of the junk files for all of the folder names in documents and settings however it would be much more efficient if I knew the active users. The script I have will do both active and inactive.

Hopefully that explains it a little better.

Thanks for your reply and explanation however. Strangely enough, in a round-a-bout way you have pointed me into a new direction. If I utilize the registry to attempt to find these or even if I can utilize the control userpasswords2 somehow to return a list of active users on the computer then that may work so thanks. I will try to go that route.
__________________
Wayne Leiser, Spectacular Computer Repair Computer Repair, Computer Services
World Famous Gift Baskets: Gift Baskets
Resources LLC: Water Treatment Coagulation, Water Recycling

Last edited by scrfix; 30-Jun-2009 at 01:58 PM..
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
30-Jun-2009, 06:49 AM #4
Net User - Gets UserName for all local accounts.

Any accounts that have not been signed into won't have a profile folder, so you'd need to do an If Exists for each one.
Note that the UserName is not always the same as the UserProfile. The UserProfile is set when the account is created, The UserName can be changed at any time.
Inactive or Domain accounts won't be listed.

wmic useraccount get Domain,Name
Same as above, but if you are connected to the Domain, it will list both Local and all Domain accounts, even if they have never signed into the particular PC.

To find the UserProfile path for only current accounts, the Registry is the way to go.
Query this key:
Code:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
Find the ones starting with S-1-5-21
Then query those for the ProfileImagePath value
S-1-5-18 is the SystemProfile
S-1-5-19 is the LocalService account
S-1-5-20 is the NetworkService account

Domain accounts that have logged into this system will also be listed here. If you need to separate those out, you'd need to use PsGetSID (part of PsTools) from Sysinternals to get the SID of the PC, then you can compare to the keys names found under ProfileList to exclude Domain accounts if desired.

Jerry
__________________
Microsoft MVP - Windows Expert - Consumer
Of course I know all the answers ; I just don't always match the answers to the right questions

Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
30-Jun-2009, 12:51 PM #5
Lots of third party utilities that can enumerate accounts as well. Even remotely.
scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
30-Jun-2009, 02:55 PM #6
Jerry,

Thanks for the advice. The "net user" was exactly what I was looking for however very good point about them changing their usernames and them being different from the profile names.

The registry entry will work perfectly. With that, I can grab a list of users and then delete the temp files from those users as well.

That will be a project for this or the next weekend.

Thanks,
__________________
Wayne Leiser, Spectacular Computer Repair Computer Repair, Computer Services
World Famous Gift Baskets: Gift Baskets
Resources LLC: Water Treatment Coagulation, Water Recycling
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
30-Jun-2009, 04:53 PM #7
I guess I don't understand what you are doing. I thought Jerry helped you with a batch file that cleared out the TEMP files already?
scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
01-Jul-2009, 12:08 AM #8
Squashman,

The original post explains that. I have one that cleans out the temp files for the active user however this requires me to sign in to each and every user on the computer in order to run that batch file.

I have devised a plan to clean the temp and T.I.F.'s for every user on the computer.

The first step is to figure out what active users are on the computer. That is what the original question was. Now that I know that, I can create (or in my case at this time, attempt to create) a FOR statement which will extract all of the active users on the computer and then with IF statements remove the proper directories with the junk files based upon the operating system.
__________________
Wayne Leiser, Spectacular Computer Repair Computer Repair, Computer Services
World Famous Gift Baskets: Gift Baskets
Resources LLC: Water Treatment Coagulation, Water Recycling
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
01-Jul-2009, 12:59 AM #9
Posted via Mobile Device
I could have sworn we covered this already in one of your previous batch files. I am pretty sure you don't have to enumerate accounts to accomplish this task.
scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
01-Jul-2009, 01:01 AM #10
I will search our past conversations. I am pretty sure it was just for that active user, deleting the %temp% directory and the temporary internet files but when deleting %temp% directory the compiled bat file would crash.
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
01-Jul-2009, 01:31 AM #11
We had a routine to copy the user profiles in this thread (around post 40-50). That same method could be used to delete the temp files, just have to exclude the current user so it won't delete the batch file, and use the method that checks for the compiled batch file for the current user.

That routine would also backup any "inactive" user profiles, which might not be wanted. There might be files to be recovered from them though.

I don't see a downside to deleting the temp files for any "inactive" accounts though. The profiles won't be usable so any temp files will just be wasting space.
__________________
Microsoft MVP - Windows Expert - Consumer
Of course I know all the answers ; I just don't always match the answers to the right questions

scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
01-Jul-2009, 01:40 AM #12
Hi Jerry,

That is also semi-referenced in the first post and referenced again in post 3. That is the one I was talking about however that does not return to me the active users. It returns to me the inactive and active users.

Cleaning the temp and temporary internet files for the inactive users is not really efficient since it serves no purpose.

If someone (XP computer) performs a dirty install of the operating system then you will end up with their old usernames on the computer in the documents and settings directory. If I utilize the script, it will look at those every time. Just not as efficient as grabbing the currently active user profiles on the computer.
__________________
Wayne Leiser, Spectacular Computer Repair Computer Repair, Computer Services
World Famous Gift Baskets: Gift Baskets
Resources LLC: Water Treatment Coagulation, Water Recycling
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
01-Jul-2009, 06:59 AM #13
I do understand what you are saying. I just think it does serve a purpose to include inactive users, to free any space used by temp files in the inactive accounts. Since they are inactive, no new files will be created. It will take longer to run the first time, but after that I don't think the time to delete files from an empty folder would be significant, unless they have a lot of inactive users.
It could also be made an option, so you can include inactive users with a command line switch.

Of course, if part of the cleanup will be to recover files from these inactive accounts, then delete them, if you do that first, it won't matter because they won't exist.

As for efficiency, I did a few time trials.
To determine the OS, and list all users, active and inactive on Win2k, XP, and Vista takes 12 lines of code, using 1 For loop. Let's call this the List All method.
Excluded All Users, Default, LocalService, NetworkService, and Public on both XP and Vista. Setting the exclusions for each OS didn't make a measurable difference.
To determine the OS, and read the Registry takes 14 lines, and two For loops. Let's call this the List Active method.

Tests performed on XP and Vista VMs in VPC 2007.
On XP:
  • Tested with 3 active users and no inactive.
  • Then added 4 inactive users.
  • Am deleting the Temp folder then recreating it.
    (Having to special case the current user when using a compiled batch would need to be done regardless of the method).
On Vista
  • Tested with 4 users including the Guest account
    My Guest account doesn't have a Temp folder, but it is listed in the Registry.
  • Then added 4 inactive users
Ran each test 7 times, discarded the fastest and slowest times, then averaged the remaining 5.

Code:
With no inactive users
Method        XP      Vista
List all    0.376     0.224
List Active 1.068     0.976

With  inactive Users
List All    0.426     0.230
List Active 1.054     0.928
So reading the Registry is slower. The more users, the slower it will be, as a separate Reg Query needs to be done for each account.

It is a better way to go though, as it will find the active accounts even if the Profile Folder has been relocated.

But then there's the issue of dual boot systems, with XP on one partition and Vista on another. Or even worse, someone who has XP and Vista installed on the same partition...

Jerry
__________________
Microsoft MVP - Windows Expert - Consumer
Of course I know all the answers ; I just don't always match the answers to the right questions

scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
01-Jul-2009, 02:03 PM #14
Wow!!

There is no room for discussion on that. Jerry, you have an extreme knack for being able to take every possible option out of a particular scenario so that there is no room for discussion. Here are the facts.. period...

Well, it appears I will take your advise and not utilize the registry. I thought that would be a more efficient way to go due to it being only active users however most computers are not going to an extreme amount of inactive users. The most I have ever seen was around 15 inactive users because their last computer guy only knew how to format and reinstall their computer. He did not actually know how to repair the issues is what is presumed. Every time they brought it in for service, it would come back with what they thought was no data on it. They were ecstatic when I "found" their data for them.

Ok. I am convinced, I will modify and utilize the original script I have for deleting those temp and temporary internet files.

Thanks again

Jerry,

Completely off the subject. From the command line, is there a way to test to see if an account has a password associated with it?

I don't care what the password is. I just want to know whether they have a password on the account. Is that possible? I have been searching everywhere I can find but have not found the answer as to whether that is even possible. The current user account is all that I care about at this time.
__________________
Wayne Leiser, Spectacular Computer Repair Computer Repair, Computer Services
World Famous Gift Baskets: Gift Baskets
Resources LLC: Water Treatment Coagulation, Water Recycling

Last edited by scrfix; 01-Jul-2009 at 03:02 PM..
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:15 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.