Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3071
  • Last Modified:

Run program on remote machine after connecting with Remote Desktop

I am using the following code to establish a connection to a Microsoft Remote Desktop.  I would like to modify this code somehow so that once the connection is made, I want a specific file to run on the remote machine.  How do I do that?  Here is the code that connects to RDP:

Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "C:\Tunnel.exe -load OPTC -pw password"
objShell.Run "mstsc /v: localhost:10001 /console /f"
0
DanielAttard
Asked:
DanielAttard
  • 6
  • 5
1 Solution
 
chandru_solCommented:
Can you put the file in the startup folder so that when you login it automatically runs or a script in the local machine in the startup folder which runs the file or the program?

regards
Chandru
0
 
DanielAttardAuthor Commented:
I tried your suggestion to put the file in the startup folder but it doesn't seem to work.  Could it be because the user I am logging in with is already logged in on the remote machine, so when I login with RDP it isn't actually "starting up", but rather control is shifted from the local user to the RDP user?

0
 
chandru_solCommented:
What is the file you are putting in the startup folder?

regards
Chandru
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DanielAttardAuthor Commented:
For now, I am putting a little VBScript file in the startup folder.  This script then launches the correct program (when run locally, but not now when run through RDP).
0
 
chandru_solCommented:
Can you post the vbcode so that i could test?
0
 
DanielAttardAuthor Commented:
This is the code that I use to bypass the windows security prompt when launching MS Access:

Const cDatabaseToOpen = "C:\path\file.mde"
On Error Resume Next
Dim AcApp
Set AcApp = CreateObject("Access.Application")
If AcApp.Version >= 10 Then
     AcApp.AutomationSecurity = 1 ' msoAutomationSecurityLow
End If
AcApp.Visible = True
AcApp.OpenCurrentDatabase cDatabaseToOpen
If AcApp.CurrentProject.FullName <> "" Then
     AcApp.UserControl = True
Else
     AcApp.Quit
     MsgBox "Failed to open '" & cDatabaseToOpen  & "'."
End If
0
 
chandru_solCommented:
Hi,

Can you try opening the mdb file?

I tried this and seems to works fine and make sure you copy the startup folder for that particular or to the startup folder for all users

regards
Chandru
0
 
DanielAttardAuthor Commented:
Ok, thanks.  I will try your suggestion after lunch.  
0
 
chandru_solCommented:
Did this work?

regards
Chandru
0
 
DanielAttardAuthor Commented:
Yes it did.  Thanks for your help.
0
 
chandru_solCommented:
Great! Thanks
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now