Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2007
    Posts
    59

    How can I collect all of the system user names?

    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

  2. #2
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    Quote Originally Posted by searcher123 View Post
    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
    You would have to query the system -- or an easier, less "exact" way would be to look at the documents & settings folder & scan all the 1st level subdirs.


    (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)

  3. #3
    Join Date
    Jun 2007
    Posts
    59
    Quote Originally Posted by jassing View Post
    You would have to query the system -- or an easier, less "exact" way would be to look at the documents & settings folder & scan all the 1st level subdirs.
    Thanks to answer Jassing,
    Document & Settings scanning is not practicability, but how should I query the system?

    Regards

  4. #4
    Join Date
    Jun 2005
    Posts
    470
    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.

  5. #5
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    Quote Originally Posted by searcher123 View Post
    Thanks to answer Jassing,
    Document & Settings scanning is not practicability, but how should I query the system?

    Regards
    Why is it not practical?
    There are api's to query the user database; I dont' know them off the top of my head... If the system is part of a network; you can talk to the AD (windows based) or NOS....
    In the absence of details, If it were me; I'd scan the directory.


    (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)

  6. #6
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    Quote Originally Posted by pww View Post
    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.


    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)

  7. #7
    Join Date
    Jun 2007
    Posts
    59
    Quote Originally Posted by pww View Post
    (...)Another way for getting a full list of user names is to redirect the output of the net user (...)
    Thanks for your suggestion. If I don't find any better solution way, I will use Net User indubitable.

    Best Regards
    Last edited by searcher123; 10-25-2008 at 02:59 PM.

  8. #8
    Join Date
    Jun 2007
    Posts
    59
    Quote Originally Posted by jassing View Post
    Why is it not practical?(...)
    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

  9. #9
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Quote Originally Posted by searcher123 View Post
    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
    Or if you rename it, The folder is still called the old name.

Similar Threads

  1. Setup Factory and VS 2005
    By vazir786 in forum Setup Factory 7.0
    Replies: 4
    Last Post: 01-13-2006, 08:47 PM
  2. Collect System Informations
    By Gianni in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 01-09-2005, 11:30 PM
  3. How do I get the exit status of a program?
    By ahewgill in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 07-22-2004, 03:46 PM
  4. HOWTO: Prompt the User for Confirmation Before Exiting
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-03-2002, 09:50 AM
  5. WINDOWS OS LANGUAGE-VARIABLE
    By dan37_123 in forum Setup Factory 6.0
    Replies: 6
    Last Post: 03-20-2002, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts