Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"FOR EACH" Question..

Status
Not open for further replies.

andreateh

Programmer
Jul 19, 2003
83
SG
For example below ...
Code:
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
colItems = objWMIService.ExecQuery("Select * from Win32_CommandLineAccess",,48)

For Each objItem in colItems
	?"Caption: " + objItem.Caption
	?"CommandLine: " + objItem.CommandLine
	?"CreationClassName: " + objItem.CreationClassName
	?"Description: " + objItem.Description
	?"InstallDate: " + objItem.InstallDate
	?"Name: " + objItem.Name
	?"Status: " + objItem.Status
	?"SystemCreationClassName: " +; objItem.SystemCreationClassName
	WScript.Echo "SystemName: " + objItem.SystemName
Next

How do we know the members and the properties in object colItems ? (beside refer to manual or documentation)
 
Try this code

lcComputer="."
loWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + lcComputer + "\root\cimv2")
loWMIClass = loWMIService.Get("Win32_CommandLineAccess")
For Each loProperty in loWMIClass.Properties_
? loProperty.name
Next



Juri Shutenko
Municipality of Maardu, Estonia
 
andreateh

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
colItems = objWMIService.ExecQuery("Select * from Win32_CommandLineAccess",,48)


The code you posted is a hybrid code. The above part is Visual Basic.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Not at all.

Properties and Methods collections should be ended with _.

This code I use to get list of properties for concrete class.
This code works fine with W2kPro/VFP8 SP1.
Just try this code...



Juri Shutenko
Municipality of Maardu, Estonia
 
Juris

Not at all.

Properties and Methods collections should be ended with _.

This code I use to get list of properties for concrete class.
This code works fine with W2kPro/VFP8 SP1.
Just try this code...


Is this comment for me?
I was pointing out to andreateh that the code that he/she posted was VB code, not yours.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike!

It's a pity but this forum structure doesn't have a node view. so I thought you comment was pointed out to my code.

My apologies...




Juri Shutenko
Municipality of Maardu, Estonia
 
Juris

It's a pity but this forum structure doesn't have a node view. so I thought you comment was pointed out to my code.

I make it a habit to address my suggestions and comments to a specific poster.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Sorry for the mistake i have been maked. I'm now learning some related to WMI. I get those code from vb forum. So i have forgot to change the code back to VFP code.

Thanks, Juri Shutenko you have give me some idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top