Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
David Crow22-Oct-08 9:57
David Crow22-Oct-08 9:57 
AnswerRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape22-Oct-08 10:24
Supriya Tonape22-Oct-08 10:24 
QuestionRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
David Crow22-Oct-08 10:35
David Crow22-Oct-08 10:35 
AnswerRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape22-Oct-08 11:23
Supriya Tonape22-Oct-08 11:23 
GeneralRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape22-Oct-08 11:30
Supriya Tonape22-Oct-08 11:30 
GeneralRe: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery22-Oct-08 14:11
Mark Salsbery22-Oct-08 14:11 
General[Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 8:40
Supriya Tonape23-Oct-08 8:40 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 9:33
Mark Salsbery23-Oct-08 9:33 
Here's some C# that lists the interactive sessions - you should be able to extract the right queries from this...
ManagementObjectSearcher logonsessionsearcher = new ManagementObjectSearcher("SELECT * FROM Win32_LogonSession Where LogonType = 2 OR LogonType = 10");
foreach (ManagementObject logonsession in logonsessionsearcher.Get())
{
    Console.WriteLine("LogonId: {0}", logonsession["LogonId"].ToString());
    Console.WriteLine("LogonType: {0}", logonsession["LogonType"].ToString());

    ManagementObjectSearcher associationsearcher = new ManagementObjectSearcher("Associators of {Win32_LogonSession.LogonId=" + logonsession["LogonId"].ToString() + "} Where AssocClass=Win32_LoggedOnUser Role=Dependent");
    foreach (ManagementObject association in associationsearcher.Get())
    {
        Console.WriteLine("   Name: {0}", association["Name"].ToString());
        Console.WriteLine("   Domain: {0}", association["Domain"].ToString());
    }
    Console.WriteLine("");
}


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 12:44
Supriya Tonape23-Oct-08 12:44 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 15:31
Mark Salsbery23-Oct-08 15:31 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 15:37
Mark Salsbery23-Oct-08 15:37 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 16:55
Supriya Tonape23-Oct-08 16:55 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 17:04
Supriya Tonape23-Oct-08 17:04 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 20:06
Mark Salsbery23-Oct-08 20:06 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 20:45
Supriya Tonape23-Oct-08 20:45 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery23-Oct-08 20:49
Mark Salsbery23-Oct-08 20:49 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape23-Oct-08 21:19
Supriya Tonape23-Oct-08 21:19 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery24-Oct-08 4:57
Mark Salsbery24-Oct-08 4:57 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape24-Oct-08 5:51
Supriya Tonape24-Oct-08 5:51 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery24-Oct-08 6:09
Mark Salsbery24-Oct-08 6:09 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape24-Oct-08 6:35
Supriya Tonape24-Oct-08 6:35 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery24-Oct-08 6:36
Mark Salsbery24-Oct-08 6:36 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape24-Oct-08 6:38
Supriya Tonape24-Oct-08 6:38 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Mark Salsbery24-Oct-08 6:39
Mark Salsbery24-Oct-08 6:39 
GeneralRe: [Urgent] Re: Getting NULL value from 'Win32_LogonSession' through WMI Pin
Supriya Tonape24-Oct-08 6:41
Supriya Tonape24-Oct-08 6:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.