Running batch file on Remote Desktop login fails

Posted on 2012-09-17
Last Modified: 2012-09-17
As just extra protection, I am wanting to backup remote sql db to my location nightly. There is no VPN so...

I created a user on the 2008 db server for the sole purpose to log on from my office and download the db bak file nightly. Gave this user read permission on the backup directory (T:\Backup\) and added to the remote users group.

I created a Automated task on my workstation that calls a rdp file that successfully connects to the db server as this user.

The rdp file specifies in the "Start a program" tab the following path:
C:\Windows\System32\mstsc.exe T:\Backup\copydb.bat

I have tested both parts:
1) Double-clicking the rdp file will login automatically.  (WORKS)
2) I can then manualy open the dos prompt and run the bat file. (WORKS)

However, the bat file does not seem to execute on connection . There is no cmd window. I can douple-click on the bat file and the cmd window will flash and go away but does not execute. The only way I've been able to get it to execute is to open the prompt and then the file.

I thought that's what this would do:
C:\Windows\System32\mstsc.exe T:\Backup\copydb.bat

What am I missing?
Question by:hitman3030
    LVL 29

    Accepted Solution

    The rdp file specifies in the "Start a program" tab the following path:
    C:\Windows\System32\mstsc.exe T:\Backup\copydb.bat

    The path should only contains the bat file

    Also did you specified the folder to start in? There are two options on Remote Desktop Connection on Programs tab, try to include the "start folder" as well:

    rdp start program

    Author Comment

    Thanks. That got me to the last hurdle. I also had to add the bat file to RemoteApps in Remote Desktop configuration.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
    Are you looking to recover an email message or a contact you just deleted mistakenly? Or you are searching for a contact that you erased from your MS Outlook ‘Contacts’ folder and now realized that it was important.
    This tutorial will show how to inventory, catalog, and restore media from legacy versions of Backup Exec into both 2012 and 2014 versions of the software. Select Storage from the tabs along the ribbon bar as the top: Ensure the proper storage devi…
    This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now