How to create a task Schedule that execute a bat file

In Vista/Seven/2008/2008R2 it´s hard to configure a task schedule that execute bat or vbs files…

With this settings you can!

Create a vbs that does runas administrator:

set WshShell = WScript.CreateObject(“WScript.Shell”)
WshShell.run “runas /user:domain\user %comspec%” ‘Open command prompt 
WScript.Sleep 1000 
WshShell.SendKeys “password” ‘send password 
WshShell.SendKeys “{ENTER}” 
WScript.Sleep 1000

Set objApp = CreateObject(“WScript.Shell”)
objApp.run “D:\Scripts_TaskSchedulers\LATAM.cmd” ‘execute the bat or cmd file
Set wshshell = nothing

Create a new task shcedule that go to find the new vbs.

It´s all!

Anuncios