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

x
?
Solved

Run Script / Batch file upon Remote Desktop Logon

Posted on 2013-02-07
6
Medium Priority
?
5,055 Views
Last Modified: 2013-02-13
Hi
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:
c:\scripts

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
c:
cd\
cd "c:\program files (x86)\S1 Manager"
SManager.exe
logoff

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

Error
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
0
Comment
Question by:RPUKsupport
  • 4
6 Comments
 
LVL 84

Expert Comment

by:David Johnson, CD, MVP
ID: 38866506
why not just run 's1.bat' ????
0
 

Author Comment

by:RPUKsupport
ID: 38867283
I tried to run just the bat as you said but still get an error.

Error
Access is denied.
The initial program cannot be started: c:\scripts\s1.bat
Please consult help for more information.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 38867301
Did you make sure the C:\Scripts folder and its contents is accessible for all users, including SYSTEM and such?
0
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.

 

Author Comment

by:RPUKsupport
ID: 38867359
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.
0
 

Accepted Solution

by:
RPUKsupport earned 0 total points
ID: 38867936
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
0
 

Author Closing Comment

by:RPUKsupport
ID: 38883767
it took lots of trouble shooting but this is how i have done it
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

916 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