I'm trying to make daily backups of database in remote server, but there is a problem with WshShell.SendKeys
not registering key presses.
I run batch file in TaskScheduler at specified time which runs "PressF5.vbs" file.
The problem is, when I am logged in in server and TaskScheduler stars task, every key gets pressed, everything works like charm. But when TaskScheduler starts task when i am logged off from RemoteServer, WshShell.SendKeys dont register as being pressed.
(By RemoteServer I mean RemoteDesktopConnection)
Code in batch file:
start /d "C:\BackUps\AutoBackups" MinimizeAll.vbs
TIMEOUT 3
start /d "C:\BackUps\AutoBackups" Create_backups_of_all_DB.sql
TIMEOUT 10
start /d "C:\BackUps\AutoBackups" PressF5.vbs
TIMEOUT 3600
start /d "C:\BackUps\AutoBackups" CreateRar.bat
Code in PressF5:
Option Explicit
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{F5}"
EDIT 1
I am trying to achieve back up creation of databases in SQL Server 2014 Management Studio. There is auto backup creator (but only in full version), which I don't own. Then after creating all databases backups, I run batch file to compress backups to RAR and delete uncompressed leftovers. Then I move that RAR to other location.
Hope that explains a little bit more what I am trying to achieve.