From: Kellie Fitton on
On Apr 24, 11:14 am, "jim clark" <nospam-j...(a)ergo.co.uk-nospam>
wrote:
> WTSEnumerateSessionsn fails if the Terminal Services service (TermService is
> not running) on XP (Error 1702). I hadn't tried it on Windows 2000 yet but I
> anticiated that it would be the same. When this service is not present the
> multiple session functionality used by TS (and FUS etc) isn't available and
> only one user can logon at a time to session zero. This seems to have
> changed in Vista because the function is always available even if the
> service is stopped.
>
> You can recreate this senario by using the QUERY program (in Windows 2003
> and Vista) with the QUERY SESSION command. This works fine when the service
> is running but fails when it is stopped. I suspect the cause is the same.
>
> Some of my customers disable this service for security reasons which means I
> cannot use WTSEnumerateSessions. I thought the LSA route would be okay but
> there is this problem that there can be more than one 'interactive' logon at
> a time.
>
> I suppose what I'm asking is - Is there a way to find the owner of the
> current 'glass console' session (maybe the Windows Station/Desktop) from a
> service?
>
> James
>


Hi,

In a terminal services session, you can use the following
WMI class to get the name of the user that is logged on
to the glass console, too bad you are unable to use WTS:

Win32_ComputerSystem

http://msdn2.microsoft.com/en-US/library/aa394102.aspx

Kellie.