Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file for remote desktop  (Read 57219 times)

0 Members and 1 Guest are viewing this topic.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Batch file for remote desktop
« Reply #15 on: August 28, 2008, 02:07:44 PM »
From reading on the web, remote desktop does not accept sendkeys. Have you got to the point where you can start RDP, and click on the OK button? That may be as far as you can go with RDP using automation.

Sendkeys does not support the Windows button, so something as simple as bringing up the run box (win-R) would be a chore. Sendkeys is fine in a small controlled environment, but on a larger scale can be a nightmare (think: 1500 machines!).

Manually, how do you do the audit? Do you have programs/scripts to run? Do you extract system information? Is the audit automated? If not can it be?

As I mentioned, there are ways to run scripts on remote machines, either with the WshController object or the newer Windows Remote Management protocol.

Sometimes it's easier to start from where you want to be and work backwards. 8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

ryank44

    Topic Starter


    Rookie

    Re: Batch file for remote desktop
    « Reply #16 on: August 29, 2008, 10:15:55 AM »
    Quote
    From reading on the web, remote desktop does not accept sendkeys. Have you got to the point where you can start RDP, and click on the OK button? That may be as far as you can go with RDP using automation.

    yeah, I have gotten that far.. I'm thinking that my only chance is to insert a Macro file, but I do not want to download a macro editor.. so was hoping to be able to do it in VB.

    Quote
    Manually, how do you do the audit? Do you have programs/scripts to run? Do you extract system information? Is the audit automated? If not can it be?

    For one PC, the audit is as follows - connect with RDP - press enter at security screen - (com loads up as username/pw is auto, so wait for com to load) - go to system info, check current version, make sure there are no errors - log out.

    So really, my auto login system is pretty fast, as I have it to remote into 30 PCs at a time, I can audit about 100 per hour.

    My current batch File is working great, I was just hoping to be able to make it a bit more efficient.

    Code: [Select]
    for /f "delims=" %%T in (computer name.txt) do (
    start mstsc /v: %%T /w:800 /h:600
    pause
    )

    I just press enter for the security screen, then click back on the cmd window, press enter, repeat. It actually is pretty fast.

    Thank you for your help tho, if I find some solution, I will post it here

    devaraju

    • Guest
    Re: Batch file for remote desktop
    « Reply #17 on: September 29, 2008, 02:06:51 AM »
    hi team,

    i have an similar issue with me daily i have to login to 12-15 windows servers and have to take report my desktop has winxp installed and the remote servers have win2k or win2k3 installed.

    my question to u people is can i write a dos script which reads the servers name and opens rdp of 12-15 servers at a time if so pls send me the script

    Thanks in advance.
    raju ???

    bakersboy



      Newbie

      Re: Batch file for remote desktop
      « Reply #18 on: October 05, 2008, 10:33:52 PM »
      Try 1/7 *.* loop it

      raemshmshetty



        Greenhorn

        Re: Batch file for remote desktop
        « Reply #19 on: October 06, 2008, 04:06:23 AM »
        Dear Friends

        I would like to write a windows bath file for the following

        to open remote desktop connection (mstsc)
        provide computer name  " computername"
        provide user name " user name"
        provide user password " password"
        provide domain name "domain name"

        to start the programme
        program path and file name "d:\notepad.txt"
        start in folder "d:\ "

        Please help me out

        I want to control my remote user to access only a particular programme not
        any other folder  or even desktop
        also tel me if there is any easiest alternative method


        thanks in advance


        ramesh shetty

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: Batch file for remote desktop
        « Reply #20 on: October 06, 2008, 04:44:47 AM »
        Raemshmshetty and Devaraju,

        Not only is it considered rude to hijack another persons thread, but many responses are customized for each situation and may not be suitable for yours.

        No matter how similar, please post your questions in a new thread.

         8)
        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein

        ryank44

          Topic Starter


          Rookie

          Re: Batch file for remote desktop
          « Reply #21 on: April 16, 2009, 01:48:53 PM »
          Ok, I have another Question on this script, so I figured I could post it back on here.

          What I need to do now is have my batch file return a true or false, if it can/cannot connect.

          Does anyone know of any method of doing this? See above for my 'for' loop, which is where I need to add it.

          More or less I am logging into a hundred PCs at a time or so, and need a result of whether I was able to connect remotely without going one by one or going thru a huge list.

          Thanks for the help, feel free to ask for additional info.

          coppaj



            Newbie

            • Experience: Beginner
            • OS: Unknown
            Re: Batch file for remote desktop
            « Reply #22 on: May 25, 2011, 07:53:00 AM »
            We made a simple batch file to ask you a computer name and connect via RDP - here is our code.  Maybe you can modify for your use:

            TITLE Brett's Remote Connection Tool
            mode con:cols=100 lines=50
            @color E
            @echo off
            REM   This is the main menu of the program.
            goto menu
            :menu
            echo Brett's Remote Connection tool v1.0
            echo.
            echo.
            echo This program will remotely connect to the PC of your choice.
            echo.
            echo  ______________________________
            echo !                              !
            echo !  1. Connect to laptop       !
            echo !  2. Connect to desktop       !
            echo !  3. Freeform entry           !
            echo !  4. Exit             !
            echo !                    !
            echo !______________________________!
            echo.

            REM   This establishes what part of the file each user input will correspond to.
            :choice
            set /P C=Enter Selection #:
            if "%C%"=="4" goto quit
            if "%C%"=="3" goto freeform
            if "%C%"=="2" goto desktop
            if "%C%"=="1" goto laptop
            goto choice



            :desktop
            set /p D=Type the desktop number:
            start mstsc /v:MAX42MGWK%D% /w:640 /h:480
            goto menu

            :laptop
            set /p L=Type the laptop number:
            start mstsc /v:MAX42MGLP%L% /w:640 /h:480
            goto menu

            :freeform
            set /p F=Type the entire PC name:
            start mstsc /v:%F% /w:640 /h:480
            goto menu

            :quit
            exit
            :end