We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Getting information about methods and properties

cescentman
cescentman asked
on
Medium Priority
1,010 Views
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"
Else
   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
     Next
     Wscript.Echo "Start Time: " & objSession.StartTime
   Next
End If

Where can I find a defintive list for the objects "objItem"  and "objSession"?
Comment
Watch Question

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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Snr. Solutions Architect
CERTIFIED EXPERT
Commented:
Thanks for the points!

Author

Commented:
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.
:) plenty of hidden goodness.
Giuseppe 'Pino' De FrancescoSnr. Solutions Architect
CERTIFIED EXPERT

Commented:
About scripting... if you want to be surprised about how many things you can do and how simply, have a look to http://kixtart.org/

Cheers
Pino

Author

Commented:
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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.