I'm trying to
make a script that gives me all the Operators names and PageAdress that are
in the Operator Table of the OnePoint Database. At the moment I my
script doesn’t generate any errors generate any errors, but I don’t know how
to handle the results.
This is my script:
Dim strQuery
Dim objDasProccessSet
strQuery = "SELECT Name, PageAddress FROM
Operator"
set objDasProcessSet = GetObject
("winmgmts:").ExecQuery(strQuery)
I don't know if I'm doing
it ok.
My problem is that I don't know how to obtain all the Names and PageAdress
from the 'objDasProcessSet'
object.
Can someone tell me how I handle the name and address variables from the
objDasProcessSet object, please?
From the microsoft.public.mom
newsgroup
Operator information is not exposed through the MOM WMI classes. We also
don't officially support accessing the DB tables directly. Here's an example
that shows how to use ADO to list open alerts using one of the (fully
supported) SDK views:
Option Explicit
Dim objConnection
Dim objCommand
Dim objRecordSet
Dim strServer
Dim strCommand
strServer = "YourDBServer" ' ** change this
strCommand = "SELECT Name, Description FROM SDKAlertView WHERE
ResolutionState <> 255"
Set objConnection = WScript.CreateObject("ADODB.Connection")
objConnection.Provider = "sqlOleDB"
Call objConnection.Open("Server=" & strServer &
";Database=OnePoint;Trusted_Connection=yes")
Set objCommand = WScript.CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = strCommand
Set objRecordSet = objCommand.Execute
WScript.Echo("All open Alerts:")
While Not objRecordSet.EOF
WScript.Echo(objRecordSet("Name"))
WScript.Echo(vbTab & objRecordSet("Description"))
WScript.Echo("")
Call objRecordSet.MoveNext
Wend
This sample doesn't attempt to handle null
values, bad connections etc.
|