How to run a C# .exe using run as... on remote desktop. Get error "Windows cannot access the specified device, path or file. You may not have the appr

  • Thread starter Thread starter GeoffreyOng
  • Start date Start date
G

GeoffreyOng

Guest
Hi there,

I'm new to the forum and reasonable new to .NET development, security policy, remote connections.
I have a C# console app which I want to run the .exe file on a remote desktop machine (from another domain).
I log in to the remote desktop using a administrative account and copy the bin/Release folder over. I am able to run the program as I am logged under a admin account, however I need to run the program using runas under a different account with no user privilege or login to this remote desktop. It is important that I use runas for this particular account because it has certain access rights in the domain which I need.

I get the following error when I try to do this:

"Windows cannot access the specified device, path or file. You may not have the appropriate permission to access the file."

I have tried deleting all my code to see what was the problem but I still get the same error. I'm starting to think that the "RunAs" user MUST have log in access to the remote desktop to run all C# .exe programs.

Everything works completely fine if I add this user to the Administrators group. However, it doesn't work if I add to any other groups (user,guests) or not adding to any group at all. I want this to work by not having to add the user to any group.

Please help me or give some knowledge if possible.

*Edit, More info:

I would really like to run a scheduled task for this application. However I get the message "Could not start" for the user I need to run as. I've done some research and looked under Local Security Settings -> Local Policies -> User Rights Assignment -> Log on as a batch job
I have added my user to that list, however I am still unable to run the scheduled task for the app.

Maybe there is another User rights assignment needed to run the C# application.

Thanks

Continue reading...
 
Back
Top