RhythmAddict112
Programmer
Hi all...Im not sure what the issue here is. I'm tryin to run a .vbs script (below) through win task scheduler..Runs fine when I term service into the box and dbl click, but no dice through the scheduler. Im running the task with an account that has local admin rights, and there aren't any drive mappings that are utilized in my script. Clearly, though, I am missing something Any ideas would be great...thought this would be a two second thing.
I have also tried to write a .bat file that would launch this .vbs but no dice on that either :-/
Code:
connStr = ("Provider=OraOLEDB.Oracle;Data Source=!@#$!@%.world;Persist Security Info=True;user id=@#$@!%;password=@#$%@;dbDBType=Oracle;PLSQLRSet=1;")
set oConn2 = CreateObject("ADODB.Connection")
oConn2.Open ConnStr
set oCmd2 = CreateObject("ADODB.Command")
oCmd2.ActiveConnection = oConn2
'revise this query to include only queues with zoning on
oCmd2.CommandText = "SELECT DISTINCT q.Q_ID, a.cAdmin_Name, a.contact_address "_
&"FROM TBL_QUEUE q, TBL_ADMINISTRATORS a, TBL_QUEUE_OPTIONS o "_
&"WHERE q.q_id = a.q_id AND o.BZONING = 1"
oCmd2.CommandType = 1
oCmd2.Prepared = True
set oRs2 = oCmd2.Execute
Dim Body
Body = "<BODY bgcolor='#f2f2e6'><UL>"
Do Until oRs2.EOF
set oCmd3 = CreateObject("ADODB.Command")
oCmd3.ActiveConnection = oConn2
oCmd3.CommandText = "SELECT COUNT(ID), TXT_PARENT_TICKET_REQUEST_ID, CITY "_
&"FROM TBL_LOC_NOT_FOUND "_
&"WHERE Q_ID = " & oRs2.Fields(0) _
&"GROUP BY TXT_PARENT_TICKET_REQUEST_ID, CITY "
set oRs3 = oCmd3.Execute
Dim Cnt
Cnt = 0
Do Until oRs3.Eof
Body = Body + "<BR><LI>" + oRs3.Fields("City") + "</LI>"
Cnt = Cnt + 1
oRs3.MoveNext
Loop
Body = Body + "</UL>"
Msg = "The application currently has " & Cnt & " unassigned locations for your queue. "
Msg = Msg + ". You should navigate to <a href='[URL unfurl="true"]http://something.com/default.htm'>here</a>[/URL] to add these locations and then assign them to zone(s)."
Set objMessage = CreateObject("CDO.Message")
objMessage.Sender = "sender@somethin.com"
'**** Commented out for testing...Real verison would use oRs2.Fields(2) ****
'objMessage.To = oRs2.Fields(2)
objMessage.To = "someone@somethin.com"
objMessage.HTMLBody = Msg & "<BR>" & Body
objMessage.Subject = "Locations"
'This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
'Name/IP of SMTP Server
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "myMailServer.myDomain.com"
'Server port
objMessage.Configuration.Fields.Item _
("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Set objMessage = nothing
oRs2.MoveNext
Loop
I have also tried to write a .bat file that would launch this .vbs but no dice on that either :-/