Vbscript issue on Windows Server 2008


we have a vbscript runs on windows server 2003 machine. moved windows 2008 machine , can't run properly. can connect to active directory, believe our database connection faulty. has changed in wscript or database connection string cause problem??

thanks.

script is listed below:

description: script sends email appropriate manager of submitting matrix analyst.
'             script identifies budget transfers have not bee approved manager ,
'             sends manager email each day transfers have not been approved.


on error resume next

'  setup oracle connection
  set dbsession = createobject("oracleinprocserver.xorasession")
  set oradatabase = dbsession.opendatabase("fcsdev","fcs/redpuppy1", 0)

'get matrix employee number

sqlstr = "select distinct(matrix_nbr)as empnum "_
 & "from budget_xfers_mo "_
 & "where fin_mgmt_appr <> 1 "_
 & "or fin_mgmt_appr null"

wscript.echo(sqlstr)

set oradata = oradatabase.createdynaset(sqlstr,0)

if oradata.recordcount > 0 then
adataarray = oradata.getrows()


wscript.echo(adataarray(0,row))


row = 0 ubound(adataarray,2)

wscript.echo(adataarray(0,0))

'  managers empnm , matrix name
errtype = ""
strsub = "uid=" & clng(adataarray(0,row)) & ",ou=people,o=fcx,c=us"
adspath = "ldap://directory.fcx.com:389/" & strsub

set oobjsec = getobject(adspath)

empnum = oobjsec.get("uid")
realname = oobjsec.get("givenname") & " " & oobjsec.get("sn")
mgrenbr = parsemgr(oobjsec.get("manager"))

wscript.echo(empnum & " " & mgrenbr)

'  managers email address
errtype = ""
strsub = "uid=" & clng(mgrenbr) & ",ou=people,o=fcx,c=us"
adspath = "ldap://directory.fcx.com:389/" & strsub

wscript.echo(strsub)

set oobjsec = getobject(adspath)

mgremailaddr = oobjsec.get("mail")


'wscript.echo(mgremailaddr)

'send email notification finance manager
   set objemail = createobject("cdo.message")
   objemail.to = sample@email.com 'matemail
   objemail.cc = "boss@email.com"  'matemail
   objemail.from = "server@email.com"
   objemail.subject = "budget transfer submitted , ready review/approval"
   strbody = "<html><head><body>"
   strbody = strbody & "a budget transfer has been submitted " & realname & " approval.<br><br>"
   strbody = strbody & "</body></head></html>"
   objemail.htmlbody = strbody
   objemail.send
   set objemail = nothing

'objemail.to = sample@email.com 'matemail

next

end if

 

'  close , destroy objects created script
'
oradata.close
oradatabase.close
'
'  reset oracle objects
'
set oradata = nothing
set oradatabase = nothing
set dbsession = nothing

function parsemgr(instr)
  outstr = ""
  start = 5
  incr = 0
  while mid(instr,start+incr,1) >= "0" , mid(instr,start+incr,1) <= "9"
    outstr = outstr & mid(instr,start+incr,1)
    incr = incr + 1
  wend

  parsemgr = outstr


end function

 

hi chris,

regarding script issue, can seek our script forum: 

http://social.technet.microsoft.com/forums/en-us/itcg/

regards

kevin

technet community support



Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file