locked
Script to login remote desktop, copy a file to remote location, and quit RRS feed

  • Question

  • Can someone please help me write a script that will do the following?

    1. Login to a remote desktop (I have saved the credentials, so it will autologin without username/pw).

    2. Copy a file in Documents (ie. C:\Users\Teiji N\Documents\data.xls) to a remote desktop location (ie. C:\Users\Adam N\Documents\). Note: I do not have a share folder.

    3. Disconnect the remote desktop session.

     

    I plan to put this script in a task scheduler so it can start automatically everyday.

     


    • Edited by Teiji Friday, September 16, 2011 11:51 PM
    Friday, September 16, 2011 11:50 PM

Answers

  • Hi,

    C$ is an administrative share.

    To run it on a schedule, put the command in a plain-text file, rename the file with a .cmd (or .bat) extension (the file extension for shell scripts), and schedule the script using the task scheduler.

    Bill

    • Proposed as answer by Bill_Stewart Monday, September 19, 2011 8:04 PM
    • Marked as answer by IamMred Tuesday, September 20, 2011 3:31 AM
    Saturday, September 17, 2011 2:04 AM

All replies

  • why can't you copy the file remotely via script? for example use "copy-item \\fileserver\file.exe \\host\c$\users\reiji n\"

    there is not need to rdp into a machine. will that work?


    Z-Hire -- Automate IT Account creation process ( AD / Exchange / Lync )
    Z-Term -- Automate IT account termination process ( AD / Exchange )
    • Proposed as answer by Denny415 Saturday, September 17, 2011 12:48 AM
    Saturday, September 17, 2011 12:48 AM
  • I don't know. I thought an rdp is needed to be opened before a file can be copy to it. If everything can be done in one step, then that's awesome.

    I'm still new at this. What does that c$ mean? And how would I save this command such that I can put it into the Task Scheduler to automate it everyday?

    Saturday, September 17, 2011 1:21 AM
  • Hi,

    C$ is an administrative share.

    To run it on a schedule, put the command in a plain-text file, rename the file with a .cmd (or .bat) extension (the file extension for shell scripts), and schedule the script using the task scheduler.

    Bill

    • Proposed as answer by Bill_Stewart Monday, September 19, 2011 8:04 PM
    • Marked as answer by IamMred Tuesday, September 20, 2011 3:31 AM
    Saturday, September 17, 2011 2:04 AM
  • I hope someone can still answer this.  In my situation, the target server is only available via RDP and I cannot access it through file shares.  The request described by the original poster is exactly what I would need...

    Wednesday, October 10, 2012 5:52 PM