troubleshooting Question

SCCM VBS Custom Detect file for application success

Avatar of Michael Sager
Michael Sager asked on
3 Comments1 Solution243 ViewsLast Modified:
Hello all - I am trying to get a VBS to detect an existence of a file - there is a possibility that the application could be ran multiple times so I am writing the file with APPLICATION_MMDDYYYY.log format that way if it ran today it detects and thinks it is a success

as for the detect of the file I have this, but only detects APLICATION.log - how do I add creating the MMDDYYYY inside of it and then detect that file?

‘Declare needed variables
Dim FSO, File, WaitTime, TotalWaitTime

‘ Initialize constants
Const InitialTime = 30000
Const Delay = 60000
Const Timeout = 600000

‘ Set inital values
Set FSO = CreateObject (“scripting.FileSystemObject”)
File = “C:\temp\APPLICATION.LOG”
WaitTime = InitialTime
TotalWaitTime = 0

‘ Loop until file is found or timeout exceeded, sleeping for WaitTime between each iteration
Do While TotalWaitTime < Timeout

TotalWaitTime = TotalWaitTime + WaitTime
WScript.sleep WaitTime
If fso.fileExists (File) Then

WScript.sleep Delay
WScript.StdOut.Write “The file was detected”

End If

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros