[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 961
  • Last Modified:

Getting information about methods and properties

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"?
0
cescentman
Asked:
cescentman
  • 3
  • 2
  • 2
2 Solutions
 
TheCleanerCommented:
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.
0
 
TheCleanerCommented:
Thanks for the points!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
cescentmanAuthor 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.
0
 
TheCleanerCommented:
:) plenty of hidden goodness.
0
 
Giuseppe "Pino" De FrancescoSenior Solution ArchitectCommented:
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
0
 
cescentmanAuthor 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.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now