On a multiuser system, how can I collect all of the system's user names when my Setup is executed under Administrator permission?
Best Regards
Professional Software Development Tools
On a multiuser system, how can I collect all of the system's user names when my Setup is executed under Administrator permission?
Best Regards
(Click here to contact me)
Providing Independent Professional Consulting Services for
IndigoRose products, World Wide.
Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
actually scanning folder names in Document & Settings is a good way for getting a list of *real* users. You should ignore stuff like
All Users
Default User
NetworkService
LocalService
and the rest of the folder names should correspond to the user profiles existing on the system. This way you'll not get the names of automatically created users such as ASPNET, IUSR_<MachineName>, IWAM__<MachineName> etc.
Another way for getting a full list of user names is to redirect the output of the
net user
command to a text file, like to File.Run a command like
net user > C:\users.txt
and then parse C:\users.txt to obtain a list of users
-----
note that there could be localization issues if you choose to scan the "Documents and Settings" folder.
I have no idea whether this folder is named "Documents and Settings" on non-English systems, nor if the names of the folders inside like "All Users" , "NetworkService" etc. are the same on non-English systems - this is something you should check.
Last edited by pww; 10-25-2008 at 09:14 AM.
(Click here to contact me)
Providing Independent Professional Consulting Services for
IndigoRose products, World Wide.
Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
I would use something like:
%CommonDocumentsFolder% .. "..\.." to get to the "root" of documents & settings; then scan it. That way; if it's different (and would work on vista/xp) you'd be good.
Of course, this method assumes you're not supporting win9x. But if you are; net user wont' help you either...
(Click here to contact me)
Providing Independent Professional Consulting Services for
IndigoRose products, World Wide.
Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
For many reasons
The follow is a very simple example:
1. Create a new limited user called "TEST_User"
2. Restart your system and log-in as TEST_User
3. Restart your system again and log-in as a user with Admin permission.
4. Delete the TEST_User account fully (i.e. when the system asked "Do you want to delete TEST_User files", click on Delete Files key).
5. restart your system again and point to Document & Settings dir. What do you see? Yes, TEST_User dir is there, but where is the user? you killed him/her
Best Regards