troubleshooting Question

Shelling from a "Window Service"

Avatar of UncleT
UncleTFlag for United States of America asked on
Programming Languages-Other.NET ProgrammingVisual Basic.NET
14 Comments2 Solutions443 ViewsLast Modified:
Hello,
I wrote a "Windows Service" that has a timer in it.  At the top of every hour I want it to shell out to a .exe file which will process some information.  The service seems to be working fine but when it hits the shell command it doesn't seem to do anything.  The service was written using "VB 2005".  The .exe file I am wanting to shell out to has a parameter to pass to it.  I can get to work using a windows app just not the service.  Here is what I am using to shell.

Shell("D:\program files\SearchEngineStudio\SearchEngineStudio.exe " + Chr(34) + "c:\Search Engine\Policy Manual.ses" + Chr(34) + " /d /r", AppWinStyle.NormalFocus)

Any help would be greatly appreciated.  
Private Sub OnTimedEvent(ByVal state As Object)
 
        Dim Hold_Date As Date
 
        oTimer.Dispose()
 
        ' Check if the the Event Log Exists 
        If Not MyLog.SourceExists("SES_Service") Then
            MyLog.CreateEventSource("SES_Service", "SES_Service Log") ' Create Log 
        End If
        MyLog.Source = "SES_Service"
 
        Hold_Date = Now
 
        If DatePart(DateInterval.Hour, Hold_Date) <> int_Previous_Hour Then
            int_Previous_Hour = DatePart(DateInterval.Hour, Hold_Date)
            Shell("D:\program files\SearchEngineStudio\SearchEngineStudio.exe " + Chr(34) + "c:\Search Engine\Policy Manual.ses" + Chr(34) + " /d /r", AppWinStyle.NormalFocus)
            ' Write to the Log 
            MyLog.WriteEntry("SES_Service Log", "Search Engine Indexed " & CStr(TimeOfDay), EventLogEntryType.Information)
        End If
 
        Dim oCallback As New TimerCallback(AddressOf OnTimedEvent)
        oTimer = New System.Threading.Timer(oCallback, Nothing, 10000, 10000)
 
    End Sub
ASKER CERTIFIED SOLUTION
bhagwantsingh

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 14 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 2 Answers and 14 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