Consulting

Results 1 to 4 of 4

Thread: RDP via VBA Macro

  1. #1
    VBAX Regular
    Joined
    Oct 2015
    Posts
    8
    Location

    Exclamation RDP via VBA Macro

    Hi Everyone.

    I have the following code to RDP to a server via Macro, however when the code runs I get a error message "Fatal Error1 while loading Language.". Help Please.....


    Private Sub Run_Click()
     Dim RetVal As Variant
     Dim Target As String
     
      Target = "10.244.254.100"
     UserName = "abc"
     Pwd = "password123"
    
            RetVal = Shell("cmdkey /generic:""" & Target & """ /user:""" & UserName & """ /pass:""" & Pwd & """", 1)
     
            RetVal = Shell("c:\Windows\System32\mstsc.exe /admin /v:" & Target, 1)
    
    End Sub
    What I want to do:

    I have nearly 90 servers, I want to RDP to each server and run a dos command remotely OR a batch file. So when I click on a Run_Click button it should run the RDP command with given credential, then remotely execute a batch file or a command line.

    Please help and many thanks in advance.

    Regards
    Ash

  2. #2
    VBAX Regular
    Joined
    Oct 2015
    Posts
    8
    Location
    Any Help??????

  3. #3
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    i am not familiar with the requirement.

    Google gave me this:

    https://mudlthru.wordpress.com/2013/...n-your-domain/

    hth
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  4. #4
    VBAX Newbie
    Joined
    Mar 2016
    Location
    New England, USA
    Posts
    1
    Location
    Hi Ash,

    I know this is an old thread... but your code works fine for me. I'm doing a very similar operation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •