I am using this script and get the following message below when I click on 
Test, and if I uncomment line 2 it returns Night Process Failed which is wrong 
it should have returned OK........
 
' Original script by Benjamin Guinebertière (DeleteOldFiles.vbs)
'On Error Resume Next
 
' Sending log message to the WhatsUp Event Viewer
Context.LogMessage "Checking Address=" & Context.GetProperty("172.16.91.247")
 
strDeviceAddr = Context.GetProperty("172.16.91.247")
strDomainUserID = Context.GetProperty("cbf4s\AutoTask")
strUserPwd = Context.GetProperty("g0n0w")
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemService = objSWbemLocator.ConnectServer(strDeviceAddr, 
"root\cimv2", strDomainUserID, strUserPwd)
 
strFolder = "M:\logs"
strFileName = "NI0."
strFileExtension = "LOG"
numDays = 1
numFiles = 0
 
' Calculate and format limit date
datLimitDate = DateAdd("d", -1 * numDays , Date)
strFormattedLimitDate = DatePart("yyyy", datLimitDate)
If DatePart("m", datLimitDate) < 10 Then
 strFormattedLimitDate = strFormattedLimitDate & "0"
End If
strFormattedLimitDate = strFormattedLimitDate & DatePart("m", datLimitDate)
If DatePart("d", datLimitDate) < 10 Then
 strFormattedLimitDate = strFormattedLimitDate & "0"
End If
strFormattedLimitDate = strFormattedLimitDate & DatePart("d", datLimitDate)
 
' Get filelist
Set colFileList = objSWbemService.ExecQuery("ASSOCIATORS OF 
{Win32_Directory.Name='" & strFolder & "'} WHERE ResultClass = CIM_DataFile")
 
' Check if there is a file created at or after limit date
For Each objFile In colFileList
 If UCase(strFileName) = UCase(Left(objFile.Filename,Len(strFileName))) And 
UCase(strFileExtension) = UCase(objFile.Extension) Then
  If Left(objFile.LastModified,8) >= strFormattedLimitDate Then
   numFiles = numFiles + 1
  End If
 End If
Next
 
If numFiles > 0 Then
 Context.SetResult 0,"Night Run Failed!"
Else
 Context.SetResult 1,"OK"
End If
 
Error......
 
Checking Address=
Error: Source:''
Line:34  Char:0
Error:0  ''
 
(null)
 
Any help would be greatly appreciated.....Thanks!

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Parady
Sent: Monday, August 13, 2007 4:37 PM
To: [email protected]
Subject: RE: [WhatsUp Forum] Whats Up Gold v11



Have you considered writing an event to event log & triggering the alert off 
that?

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Verkamp
Sent: Monday, August 13, 2007 5:23 PM
To: [email protected]
Subject: [WhatsUp Forum] Whats Up Gold v11

 

I am trying to setup an alert to tell me when a scheduled task has completed or 
is running on a windows 2003 server.  I found the script on the IPSwitch 
website to do this, but the application process id doesn't show in the list of 
available processes to select through WMI.  Any suggestions?

Thanks, 
Tim 

 

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.17/951 - Release Date: 8/13/2007 
10:15 AM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.17/951 - Release Date: 8/13/2007 
10:15 AM


Reply via email to