Here you go Gerard, save this as a .VBS file and run it (at your own risk ;) ).
YOU NEED TO RUN IT WITH AN ACCOUNT THAT HAS RIGHTS TO QUERY THE DB. That last bit is very important in case you couldn't tell :)
(I've also included some REMmed out code that allows you to connect using no explicit username and password for security reasons. See caveat in upper case above if you do this. Also, it assumes you've named your DS database as 'express' and that you have a directory called 'c:\temp' available)
See what you think
R
------------------------------------------
Const adOpenStatic = 3
Const adLockOptimistic = 3
Dim objFSO, objConnection, objRecordSet, objLog
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
Set objLog = objFSO.CreateTextFile("C:\temp\scripts\dscompnames.log")
objConnection.Open _
"Provider=SQLOLEDB;Data Source=<servernamehere>;" & _
"Trusted_Connection=Yes;Initial Catalog=express;" & _
"User ID=<DOMAIN\Usernamehere>;<passwordhere>;"
' objConnection.Open _
' "Provider=SQLOLEDB;Data Source=<servernamehere>;" & _
' "Trusted_Connection=Yes;Initial Catalog=Express;"
objRecordSet.Open "SELECT Name FROM dbo.computer", _
objConnection, adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.RecordCount
objLog.WriteLine objRecordSet.Fields("Name")
objRecordSet.movenext
Loop
objRecordSet.Close
objLog.Close
Set objRecordSet = Nothing
Set objConnection = Nothing
Set objFSO = Nothing
----------------------------------------------