mutley1
MIS
- Jul 24, 2003
- 909
Hi all,
Not sure if this is a DTS or VB question so apologies if it is in the wrong forum.
i have a package that is running fine on 1 server using the following VB. It creates a text file and sends the results out.
I have saved the DTS package to another server, scheduled it but it sends empty text files (I have also recreated the directory where it reads text files from etc.). If I run it from DTS designer, it works fine and sends files with data in it, but the scheduled job sends blank files. All SQL accounts are the same on both servers.
Any ideas welcomed.
Thanks.
M.
Not sure if this is a DTS or VB question so apologies if it is in the wrong forum.
i have a package that is running fine on 1 server using the following VB. It creates a text file and sends the results out.
Code:
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
On Error Resume Next
'Set the report output directory (end with a backslash) dir = "D:\TrimServicesAnalysis\"
'Set the text report file name
filename = "WorkgroupServiceStatus.txt"
'open the file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
set WSHShell = wscript.createObject("wscript.shell")
'open the data file
Set oTextStream =
oFSO.OpenTextFile("D:\TrimServicesAnalysis\LISTWorkgroup.txt")
'make an array from the data file
RemotePC = Split(oTextStream.ReadAll, vbNewLine) 'close the data file oTextStream.Close
For Each strComputer In RemotePC
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery _
("Select * from Win32_Service")
For Each objService in colRunningServices
If ucase (objService.DisplayName) = "TRIM CONTEXT WORKGROUP SERVER"
Then
Report = Report & vbCrLf & "Computer " & strComputer & " reports service " & objService.DisplayName & " is " & objService.State
End If
Next
Next
If Not oFSO.FolderExists(dir) Then
oFSO.CreateFolder(dir)
End If
Set ts = oFSO.CreateTextFile (dir & filename, True) ts.write report
Main = DTSTaskExecResult_Success
End Function
I have saved the DTS package to another server, scheduled it but it sends empty text files (I have also recreated the directory where it reads text files from etc.). If I run it from DTS designer, it works fine and sends files with data in it, but the scheduled job sends blank files. All SQL accounts are the same on both servers.
Any ideas welcomed.
Thanks.
M.