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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help speeding up my WMI query

Status
Not open for further replies.

computerhighguy

IS-IT--Management
Oct 13, 2003
579
US
I can get my WMI query to work using the below script. I am pretty sure it loops through everything looking for my one attribute. How can I make this query just the attribute I want to echo it to the screen.

Code:
Dim objWMI : Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from MSFT_SIPLogSetting")
Dim objComputer, strModel
  For Each objComputer in colSettings 
	strModel = objComputer.TimeToBeReceived
  Next
wscript.echo strModel

I figure I should be able to a query something like this.

Code:
Select * from MSFT_SIPLogSetting WHERE Name = 'TimeToBeReceived'

but I am not certain how to make that work. It doesn't seem to be a collection if I use the above OR there is nothing in the collection. Any help is appreciated. Thanks.

It is what it is!!
__________________________________
A+, Net+, I-Net+, Certified Web Master, MCP, MCSA, MCSE, CCNA, CCDA, and few others (I got bored one day)
 
if there's nothing in the collection, it will not loop. it should be ok even if there's one or zero entries in the collection.
 
[0]
>Select * from MSFT_SIPLogSetting WHERE Name = 'TimeToBeReceived'
>but I am not certain how to make that work.
The whole idea is not correct. It is not to set Name equal to some attribute.

[1] If you mean to retrieve only TimeToBeReceived, it is this.
[tt] Select TimeToBeReceived from MSFT_SIPLogSetting[/tt]

[2] If you mean to select specific instances where TimeToBeReceived is restricted to some condition, then it is this, for instance, less than 720.
[tt] Select * from MSFT_SIPLogSetting WHERE TimeToBeReceived<720[/tt]
 
Other than changing the Select statement, is there any way to speed up returning this value?

It is what it is!!
__________________________________
A+, Net+, I-Net+, Certified Web Master, MCP, MCSA, MCSE, CCNA, CCDA, and few others (I got bored one day)
 
MSFT_SIPLogSetting seems not be a big class, I don't think variations, such as instanceof()... would have a bigger impact. Precise and restrictive query string construction of sql flavor is still the main dosage for performance. Semi-synchronous query may take away part of the waiting, but I doubt it being very critical _here_.
For some huge class, like cim_datafile, to salvage performance they make some associator to drastically improve the performance. But do you know there is any for the class in question? What is the concern? A slow performance sometimes means to bring down the whole system to its knee. I don't think it is your concern!
 
I am building a suedo-support tool that will return a bunch of different info from WMI pertaining to Office Communications Server 2007. The issue I am running into is that in order to query say 5 different value, it could take as long at 10 minutes. I could use WBEMTEST and get the info manually in less time that that and change anything I may need as well. I will check on the associator, but I just stepped out of my area of operation.

It is what it is!!
__________________________________
A+, Net+, I-Net+, Certified Web Master, MCP, MCSA, MCSE, CCNA, CCDA, and few others (I got bored one day)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top