Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - VBScript + WMI + SQL Server = troubles

Reply
 
Old 10-01-2009   #1 (permalink)
Wojtek Piszczek


 
 

VBScript + WMI + SQL Server = troubles

Hello,

I'am trying to read some performance counters from MSSQL 2008 using
vbscript via WMI (to be strict, what I need is number of logins to the
server).

Normally (I mean, just like for any other windows performance counter) you
would use something like:

---code start---------------
Set objLocator = CreateObject("WbemScripting.SwbemLocator")
Set objWMIService = objLocator.ConnectServer("", "root\cimv2")

sQry = "Select * from " & _
"Win32_PerfFormattedData_MSSQLSERVER_SQLServerGeneralStatistics"
Set colItems = objWMIService.ExecQuery(sQry,"WQL",48)
For Each objItem in colItems
wscript.echo "SQL, UserConnections : " & objItem.UserConnections
Next
---code start---------------

Unfortunately it returns always 0.What is more, running following:
|Get-WmiObject -Class
| Win32_PerfFormattedData_MSSQLSERVER_SQLServerGeneralStatistics
from PowerShell returns zeros as well. But the same counter choosen in
perfmon shows proper value. Both OS and SQL server are 32 bit.

What am I doing wrong?

Regards

--
Wojtek Piszczek

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
VBscript in 2008 Server Task Scheduler will not run VB Script
VBScript to send email not working on 1 server VB Script
VBScript to send email not working on 1 server VB Script
Vista & Home Network Web Server Troubles Vista General
Media Server Troubles Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46