Solved

Run program on remote machine after connecting with Remote Desktop

Posted on 2007-11-17
11
3,064 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
  • 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
 

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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now