Getting information about methods and properties

Posted on 2006-04-04
Last Modified: 2008-02-26
Maybe I'm being thick but I find it very difficult to identify resources that list methods and properties for objedcts created in scripting.

For example in the code:-

Set objWMI = GetObject("winmgmts:" _
              & "{impersonationLevel=impersonate}!\\" _
              & strComputer & "\root\cimv2")

Set colSessions = objWMI.ExecQuery _
      ("Select * from Win32_LogonSession Where LogonType = 10")

If colSessions.Count = 0 Then
   Wscript.Echo "No interactive user found"
   For Each objSession in colSessions

     Set colList = objWMI.ExecQuery("Associators of " _
         & "{Win32_LogonSession.LogonId=" & objSession.LogonId & "} " _
         & "Where AssocClass=Win32_LoggedOnUser Role=Dependent" )

     For Each objItem in colList
       WScript.Echo "User: " & objItem.Name
       WScript.Echo "FullName: " & objItem.FullName
       WScript.Echo "Domain: " & objItem.Domain
     Wscript.Echo "Start Time: " & objSession.StartTime
End If

Where can I find a defintive list for the objects "objItem"  and "objSession"?
Question by:cescentman
    LVL 23

    Assisted Solution

    Well, you could use a scripting tool like PrimalScript that auto-fills.

    But you can get a list of all the WMI objects and methods by opening this program:

    In here:  C:\windows\system32\wbem

    run wbemtest.exe

    Then click Connect.

    Change the namespace to root\CIMv2

    Then the buttons will appear.

    Click enum classes, choose recursive and hit OK.  This will list all the classes.

    Find the class you are talking about...for instance Win32_LogonSession and click OK.

    It will then list the class and the associated properties and/or methods.  (for LogonSession there are just properties)

    You can even choose a property or method and get a list of all the existing instances right there by click "Instances".

    Hope that helps.
    LVL 6

    Accepted Solution

    LVL 23

    Expert Comment

    Thanks for the points!
    LVL 1

    Author Comment

    Good tip it was I never cease to be amazed by the way I am constantly discovering features that live as default on my PCs and servers. Only yesterday I came accross references to qwinsta.exe on TS boxes what a boon I've used it twice today.
    LVL 23

    Expert Comment

    :) plenty of hidden goodness.
    LVL 6

    Expert Comment

    by:Giuseppe De Francesco
    About scripting... if you want to be surprised about how many things you can do and how simply, have a look to

    LVL 1

    Author Comment

    I've often toyed with KIX I like it a lot and I agree that in many ways it is more accesible but I am trying to concentrate on not using anything other than native MS features as it is easier to quickly port script.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
    Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now