|
|
|
date: Mon, 7 Jul 2008 12:31:08 -0700,
group: microsoft.public.platformsdk.security
back
Re: How to enumerate Windows user accounts?
On Jul 7, 12:31 pm, "Justin Magaram" wrote:
> I need to programatically generate the names and SIDs of each real human
> user of the computer. I want the EXACT same list as appears on the Windows
> Welcome screen, and I need to do this for both XP and Vista. This is for a
> consumer/home application, so I'm not interested is listing the names of
> everyone in the Windows 2003 directory. I also need to know who is an
> administrator or not. My current approach is to use WMI and enumerate
> Win32_GroupUser for both "Administrators" and "Users". I then drill down on
> each Win32_UserAccount looking for accounts where Disabled=false, SIDType=1,
> AccountType=512, Status=OK, and LocalAccount=true. This approach is close
> but no cigar. It returns the "ASP.NET" account and sometimes the account
> called "Administrator" even though neither of these names appear on the
> Windows welcome screen.
>
> What is the secret sauce that determines if a user account appears on the
> Windows welcome screen?
> Is there some way of getting this information with WMI or .net?
> If not, what scary Win32 APIs do I need to use?
Hi,
You can use the following WMI class to get the name of a user
that is logged on to the console (terminal services session):
Win32_ComputerSystem
You can use the following APIs to test whether the current user
is a member of the Administrator's group:
IsUserAnAdmin()
CheckTokenMembership()
http://msdn.microsoft.com/en-us/library/aa394102(VS.85).aspx
http://msdn2.microsoft.com/en-us/library/bb776463.aspx
http://msdn2.microsoft.com/en-us/library/aa376389.aspx
http://support.microsoft.com/kb/118626/en-us
Kellie.
date: Tue, 8 Jul 2008 08:45:31 -0700 (PDT)
author: Kellie Fitton
Re: How to enumerate Windows user accounts?
Maybe I wasn't clear enough. I'm trying to enumerate the list of people who
can log on at the Windows Welcome screen, not get information about someone
who is currently logged on. So my question still is unanswered.
"Kellie Fitton" wrote in message
news:1c58975c-7f18-4e87-98fb-f08d7380a17f@d1g2000hsg.googlegroups.com...
On Jul 7, 12:31 pm, "Justin Magaram" wrote:
> I need to programatically generate the names and SIDs of each real human
> user of the computer. I want the EXACT same list as appears on the Windows
> Welcome screen, and I need to do this for both XP and Vista. This is for a
> consumer/home application, so I'm not interested is listing the names of
> everyone in the Windows 2003 directory. I also need to know who is an
> administrator or not. My current approach is to use WMI and enumerate
> Win32_GroupUser for both "Administrators" and "Users". I then drill down
> on
> each Win32_UserAccount looking for accounts where Disabled=false,
> SIDType=1,
> AccountType=512, Status=OK, and LocalAccount=true. This approach is close
> but no cigar. It returns the "ASP.NET" account and sometimes the account
> called "Administrator" even though neither of these names appear on the
> Windows welcome screen.
>
> What is the secret sauce that determines if a user account appears on the
> Windows welcome screen?
> Is there some way of getting this information with WMI or .net?
> If not, what scary Win32 APIs do I need to use?
Hi,
You can use the following WMI class to get the name of a user
that is logged on to the console (terminal services session):
Win32_ComputerSystem
You can use the following APIs to test whether the current user
is a member of the Administrator's group:
IsUserAnAdmin()
CheckTokenMembership()
http://msdn.microsoft.com/en-us/library/aa394102(VS.85).aspx
http://msdn2.microsoft.com/en-us/library/bb776463.aspx
http://msdn2.microsoft.com/en-us/library/aa376389.aspx
http://support.microsoft.com/kb/118626/en-us
Kellie.
date: Tue, 8 Jul 2008 09:17:59 -0700
author: Justin Magaram
Re: How to enumerate Windows user accounts?
On Jul 8, 8:45 am, Kellie Fitton wrote:
> On Jul 7, 12:31 pm, "Justin Magaram" wrote:
>
>
>
>
>
> > I need to programatically generate the names and SIDs of each real human
> > user of the computer. I want the EXACT same list as appears on the Windows
> > Welcome screen, and I need to do this for both XP and Vista. This is for a
> > consumer/home application, so I'm not interested is listing the names of
> > everyone in the Windows 2003 directory. I also need to know who is an
> > administrator or not. My current approach is to use WMI and enumerate
> > Win32_GroupUser for both "Administrators" and "Users". I then drill down on
> > each Win32_UserAccount looking for accounts where Disabled=false, SIDType=1,
> > AccountType=512, Status=OK, and LocalAccount=true. This approach is close
> > but no cigar. It returns the "ASP.NET" account and sometimes the account
> > called "Administrator" even though neither of these names appear on the
> > Windows welcome screen.
>
> > What is the secret sauce that determines if a user account appears on the
> > Windows welcome screen?
> > Is there some way of getting this information with WMI or .net?
> > If not, what scary Win32 APIs do I need to use?
>
> Hi,
>
> You can use the following WMI class to get the name of a user
> that is logged on to the console (terminal services session):
>
> Win32_ComputerSystem
>
> You can use the following APIs to test whether the current user
> is a member of the Administrator's group:
>
> IsUserAnAdmin()
>
> CheckTokenMembership()
>
> http://msdn.microsoft.com/en-us/library/aa394102(VS.85).aspx
>
> http://msdn2.microsoft.com/en-us/library/bb776463.aspx
>
> http://msdn2.microsoft.com/en-us/library/aa376389.aspx
>
> http://support.microsoft.com/kb/118626/en-us
>
> Kellie.- Hide quoted text -
>
> - Show quoted text -
There may be something in the registry that is used directly by GINA,
but failing to find that, you should be able to use the SIDs listed in
HKEY_USERS. This is a list of every user that has interactively logged
on to the computer and had a profile loaded. You'll probably have to
parse this list and filter out a few built-in accounts that you don't
want to display. The Windows code that shows the list probably does
filtering as well, so you likely aren't going to find a list that
matches your exact requirements.
HTH,
Dave
date: Wed, 9 Jul 2008 07:38:29 -0700 (PDT)
author: DaveMo
|
|