I have created one windows application which will create a folder and write file into that.
i created task scheduler in windows server 2012 R2 . as below
2. i had configure to the account which is having admin access
3.
Problem:
1. The task scheduler is execute the exe command . but the problem is its not opening the form so that the vb script not find the button to click so that the task get started.
2. i am not sure where is the problem. but what i feel is to hit enter button from vb script the form has to be open in system.
Note:when ever i tried and double click on batch file its opening the form and clicking on button. working as expected .
What I have tried:
1.created task scheduler. where i have given path of batch file . what it does is , batch file calls a vb script and the vb script calls exe file and press enter button so that the exe will start executing.
2. Below is the congfiguration of task scheduler
Step 1: Create a batch file you wish to run and place it under a folder where you have enough permissions. For example under C drive.
Step 2: Click on Start and under search, type in Task and click open Task Scheduler.
Step 3: Select Create Basic Task from the Action pane on the right of the window.
Step 4: Under Create Basic Task, type in the name you like and click Next.
Step 5: From the Trigger select the option you like and click Next.
I chose Daily and clicked Next, which brought me to this screen.
Step 6: Then click on Start a Program and click Next.
Step 7: Now click on Browser and select the batch file you like to run.
Step 8: Finally, click on Finish to create the Task.
Step 8: Click on Run with Highest privilege then click OK.
My Vb script look like below
<pre lang="vb">
Dim shell
set shell = WScript.CreateObject("WScript.Shell")
shell.Run "\\10.248.8.162\Shared\Sunil\DailyReporting\RunTool\Tool\ProductionMonitoringTool.exe"
shell.AppActivate "MonitoringForm"
WScript.Sleep 2000
shell.SendKeys "Going to press enter"
shell.SendKeys "{ENTER}"
shell.SendKeys "pressed enter"