Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run active x script by scheduled task

Status
Not open for further replies.

mrsdba

IS-IT--Management
Joined
May 10, 2010
Messages
1
Location
US
hi i have created an which is running perfectly under a ssis package with the desired output , but i tried executing it as a windows scheduled task and eventhough it runs with no errors it does not do anything.

'************************************************* ***********
' Visual Basic ActiveX Script
'************************************************* ***********

Function Main()

Dt = now()

y = Right(Year(Dt),2)
m = Month(Dt)
d = Day(Dt)

If Len(m) = 1 Then
m = "0" & m
End If

If Len(d) = 1 Then
d = "0" & d
End If

Filename= m & d & y & ".txt"


SFile ="C:\archive\"

DFile ="C:\archive\"


SFile1 = SFile &"UtilityDB_log_"& Filename
SFile2 = SFile &"Distributor_log_"& Filename



DFile1 =DFile & "UtilityDB_log.txt"
DFile2 =DFile & "Distributor_log.txt"



Set FSO = CreateObject("Scripting.FileSystemObject")



If (FSO.FileExists(DFile1)) Then


Set NewFile = FSO.GetFile(DFile1)
NewFile.Copy(SFile1)
FSO.DeleteFile(DFile1)


End If

If (FSO.FileExists(DFile2)) Then

Set NewFile = FSO.GetFile(DFile2)
NewFile.Copy (SFile2)
FSO.DeleteFile(DFile2)

End If




Set FSO = Nothing
Main = DTSTaskExecResult_Success
End Function






I do have all the permissions to do this delete(when executing the ssis i used my login and when scheduling windows task i use my credentials)

this is what i did.

I have the script saved as a c:\temp\scripts\rename.vbs

i went to schedule tasks, under run i clicked browse and choose my vbs file, added my login. It runs fine but like i said it does not return any outputs.


Can someone tell me what am i doing wrong.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top