Hi,
I had written the following codes as separate vbs files and then
called each of them using a batch file that in turn is configured in
Task Scheduler in windows, to run whenever the system starts up.
The problem I'm facing is ... the second process(cdxfm.exe) does not
show as a window on desktop. I mean both the process'(esproc_TUW.exe
and cdxfm.exe) should be seen as normal sized windows whenever I login
with the service account used to run the Task scheduler. But, I see
only the window for 'esproc_TUW.exe' and do not see any window on
desktop for 'cdxfm.exe'. I would like to mention another thing that
this works fine when I run the Task Scheduler manually, however does
not work as expected when the server is restarted and the Task
scheduler takes action on its own. This was verified after logging
into the server using the same service account and did not find the
second process(cdxfm.exe) window open but I can see 2 process ID's for
the 1st one and only 1 process id for the second one, with the second
one not showing up in front as a window. I have tried the following
vbs codes to no avail.
Code 1:
strProcess1 = "cdxserv.exe"
strComputer = "."
WScript.Echo Date & vbTab & Time & vbTab & "Start of Script..."
Call Process1
WScript.Echo Date & vbTab & Time & vbTab & "...End of Script"
WScript.Quit
Sub Process1()
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "D:\ESPS\CoreDoss\esproc_TUW.exe -D -I", 1
WshShell.Run "D:\ESPS\CoreDoss\cdxfm.exe", 1
WScript.Echo Date & vbTab & Time & vbTab & "Created Process: " &
strProcess1 & " on " & strComputer
End Sub
Set WshShell = Nothing
Code 2:
Const priorityNormal = 32
Const SW_SHOWNORMAL = 1 ' ShowWindow (api) constants...
Const SW_SHOWMAXIMIZED = 3
Dim oWMI : Set oWMI = GetObject("winmgmts:")
Dim oProcess : Set oProcess = oWMI.Get("Win32_Process")
Dim oStartupInfo : Set oStartupInfo =
oWMI.Get("Win32_ProcessStartup")
Process1
Process2
Sub Process1()
sCommandLine = "esproc_TUW.exe -D -I"
sCurrentDirectory = "D:\ESPS\CoreDoss\"
oStartupInfo.PriorityClass = priorityNormal
oStartupInfo.ShowWindow = SW_SHOWNORMAL ' SW_SHOWMAXIMIZED
' create process returns a 0 if the process was created successfully.
iResult = oProcess.Create(sCommandLine, sCurrentDirectory,
oStartupInfo, processID)
if (iResult = 0) then ' success
WScript.Echo "Create Process was Successful, " & " processid=" &
processID,vbSystemModal
Else
WScript.Echo "iResult=" & iResult & " processid=" &
processID,vbSystemModal
End if
End Sub
Sub Process2()
sCommandLine = "cdxfm.exe"
sCurrentDirectory = "D:\ESPS\CoreDoss\"
oStartupInfo.PriorityClass = priorityNormal
oStartupInfo.ShowWindow = SW_SHOWNORMAL ' SW_SHOWMAXIMIZED
' create process returns a 0 if the process was created successfully.
iResult = oProcess.Create(sCommandLine, sCurrentDirectory,
oStartupInfo, processID)
if (iResult = 0) then ' success
WScript.Echo "Create Process was Successful, " & " processid=" &
processID,vbSystemModal
Else
WScript.Echo "iResult=" & iResult & " processid=" &
processID,vbSystemModal
End if
End Sub
WScript.Quit
Code3: (Batch file)
Start /min D:\ESPS\CoreDoss\esproc_TUW.exe
Start /min D:\ESPS\CoreDoss\cdxfm.exe
Any help is very much appreciated !!!


