Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set objArgs = Wscript.Arguments
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
Dim ConnString
ConnString = "DRIVER={SQL Server};Server=" & objArgs(0) & ";Database=" & objArgs(1) & ";"
objConnection.Open ConnString
objRecordSet.Open "SELECT TOP(1) CC.CollectionID, CN.CollectionName, CC.TimeUpdated FROM Collection_MemberChg_Notif CC JOIN Collections CN ON CC.CollectionID = CN.SiteID WHERE CN.CollectionName = 'Test Collection' AND CC.TimeUpdated < DATEADD(mi, -20, GETDATE())", objConnection, 3, 3
oBag.AddValue "Records", objRecordSet.RecordCount
If objRecordSet.RecordCount > 0 Then
oBag.AddValue "LastUpdated", CStr(objRecordSet.Fields("TimeUpdated"))
Call oAPI.LogScriptEvent(objArgs(1), 101, 0, "Last Updated: " & objRecordSet.Fields("TimeUpdated"))
Else
Call oAPI.LogScriptEvent(objArgs(1), 0, 0, "Up to date")
End If
oAPI.Return(oBag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.