PDA

View Full Version : RDP via VBA Macro



Ash786
10-19-2015, 06:07 AM
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.....

:banghead:


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.:clap:

Regards
Ash

Ash786
10-20-2015, 03:52 AM
Any Help??????

mancubus
10-20-2015, 04:29 AM
i am not familiar with the requirement.

Google gave me this:

https://mudlthru.wordpress.com/2013/03/13/create-a-remote-desktop-connection-for-each-server-in-your-domain/

hth

ctbailey
03-21-2016, 09:23 AM
Hi Ash,

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