Solved

Run program on remote machine after connecting with Remote Desktop

Posted on 2007-11-17
11
3,069 Views
Last Modified: 2008-02-01
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
Comment
Question by:DanielAttard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20306759
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
 

Author Comment

by:DanielAttard
ID: 20307559
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
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20307635
What is the file you are putting in the startup folder?

regards
Chandru
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

Author Comment

by:DanielAttard
ID: 20307684
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
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20307691
Can you post the vbcode so that i could test?
0
 

Author Comment

by:DanielAttard
ID: 20307703
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
 
LVL 12

Accepted Solution

by:
chandru_sol earned 500 total points
ID: 20308001
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
 

Author Comment

by:DanielAttard
ID: 20308156
Ok, thanks.  I will try your suggestion after lunch.  
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20381841
Did this work?

regards
Chandru
0
 

Author Comment

by:DanielAttard
ID: 20383983
Yes it did.  Thanks for your help.
0
 
LVL 12

Expert Comment

by:chandru_sol
ID: 20386842
Great! Thanks
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question