July 25, 2002 at 8:09 am
Hi, I've found a DMO script that displays the version, and I would like get rid of the version information (oServer.VersionString) and instead add a sql query that I have. I want to add the query in the loop. Below is the current code:
'This script outputs the version info
'from a list of servers provided in a text file.
IF Wscript.Arguments.Count = 0 THEN
MsgBox "Server List Missing", vbCritical
Wscript.Quit
END IF
SET oServer = CreateObject("SQLDMO.SQLServer")
oServer.LoginSecure = True
SET fso = CreateObject("Scripting.FileSystemObject")
SET oFileTargets = fso.OpenTextFile(Wscript.Arguments(0),1)
DO UNTIL oFileTargets.AtEndOfStream
sTarget = oFileTargets.ReadLine
oServer.Connect sTarget
Wscript.Echo sTarget & ": " & oServer.VersionString
oServer.Disconnect
LOOP
''''Clean up'''''
SET oServer = Nothing
SET oFileTargets = Nothing
SET fso = Nothing
July 25, 2002 at 7:26 pm
I think this got cross posted and I replied to the other post, but just to be sure - you can execute a query using the executeimmedate (or its similar methods) which will return a queryresults object, or you can just open an ADO connection and use that, which is probably cleaner.
One other thought, it's possibly to get the list of servers using DMO as long as they are "advertised". If all of yours are you could bypass the need for the disk file.
Andy
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply