SSIS 2008 Script Task Error
This is the code kept in my script Task
Dim TheFile As String
Dim DestFolder As String
Dim URL As String
Try
TheFile = "VIVA CDR.xls"
DestFolder = "C:\SSIS_Sources\Call History\VIVA CDR\"
URL = "http://citsharepoint/portals/SysAdmin/PD/Shared Documents/Call History/VIVA CDR.xls"
Dim xml = CreateObject("Microsoft.XMLHTTP")
xml.Open("GET", URL, False)
xml.Send()
Dim oStream = CreateObject("Adodb.Stream")
Dim adTypeBinary As Integer = 1
Dim adSaveCreateOverWrite As Integer = 2
oStream.type = adTypeBinary
oStream.open()
oStream.write(xml.responseBody)
oStream.savetofile(DestFolder & TheFile, adSaveCreateOverWrite)
oStream.close()
oStream = Nothing
xml = Nothing
Dts.TaskResult = ScriptResults.Success
Catch ex As Exception
End Try
While saving the code i am getting the following error: Scriptmain.vb VBS/Psyme (Trojan)
Thanks
Thiru
December 9th, 2010 4:32pm
Hi Thiru,
The error "Scriptmain.vb VBS/Psyme (Trojan)" may be caused by the code "Dim xml = CreateObject("Microsoft.XMLHTTP")"
in insecurity in the SQL Server Integration Services(SSIS) script task.
I would suggest you using HTTPWebRequest instead to download the Excel file. Below is the code snippet for your reference:
Dim URL As String = "http://citsharepoint/portals/SysAdmin/PD/Shared Documents/Call History/VIVA CDR.xls"
Dim Req As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(URL), System.Net.HttpWebRequest)
Req.Credentials = System.Net.CredentialCache.DefaultCredentials
Req.Method = "GET"
Dim path As String = "C:\\VIVA CDRxls"
Dim objResponse As System.Net.WebResponse = Req.GetResponse()
Dim fs As New System.IO.FileStream(path, System.IO.FileMode.Create)
Dim stream As System.IO.Stream = objResponse.GetResponseStream()
Dim buf As Byte() = New Byte(1023) {}
Dim len As Integer = stream.Read(buf, 0, 1024)
While len > 0
fs.Write(buf, 0, len)
len = stream.Read(buf, 0, 1024)
End While
stream.Close()
fs.Close()
If you have any more questions, please feel free to ask.
Thanks,
Jin Chen
Jin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2010 11:16pm
Hi,
Thanks a lot. After long time i have returned to office .
Thanks & Regards,
Thiru
December 20th, 2010 12:57pm