• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5354
  • Last Modified:

Run Script / Batch file upon Remote Desktop Logon

I am having some issues on running scripts upon initial logon for remote desktop users when connecting to a windows 2008r2 server.
I run an application on there and most users connect using remote app, however this does not work on one or 2 users due to a problem in the software (so this is a software vendor issue) but lets not worry about that.
What I want is to be able to connect via remote desktop and for the software to run directly on the server (almost the same as remote app)
Before, I used to use a script in the Remote Desktop Connection saved file under programs and run the following:

Program path and file name:
wscript "c:\Scripts\S1.vbs"
Start in the following folder:

This would then run the file S1.vbs, which is as below:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\Scripts\S1.bat", 0

Which runs the following batch file:

@echo off
cd "c:\program files (x86)\S1 Manager"

Now, I am sure it is something to do with the local security policy on the server, I get the following error message:

Access is denied.
The initial program cannot be started:
C:\windows\system32\wscript.exe “c:\scripts\s1.vbs”
Please consult help for more information.

it will not let the script call the execute file remotley. I cannot do this with a standard user or domain admin
  • 4
1 Solution
David Johnson, CD, MVPOwnerCommented:
why not just run 's1.bat' ????
RPUKsupportAuthor Commented:
I tried to run just the bat as you said but still get an error.

Access is denied.
The initial program cannot be started: c:\scripts\s1.bat
Please consult help for more information.
QlemoBatchelor and DeveloperCommented:
Did you make sure the C:\Scripts folder and its contents is accessible for all users, including SYSTEM and such?
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

RPUKsupportAuthor Commented:
yes all credentials are correct, full access to system and domain admins and read only for SManager users. The folder is accessible from the server itself ok and runs on the server ok once your logged in. I want it to run automatically though.
RPUKsupportAuthor Commented:
I have found out how to do this.
All I did was to add the bat file, the vbs script and wscript.exe to remote applications in remoteapp manager and it all works ok
RPUKsupportAuthor Commented:
it took lots of trouble shooting but this is how i have done it
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

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