Forum: SuRun English speaking RSS
How to execute a BAT file from a share ?
ManelR #1
Member since Feb 2011 · 2 posts
Group memberships: Mitglieder
Show profile · Link to this post
Subject: How to execute a BAT file from a share ?
Hello,

First of all, this is my first post in these forums but I've been a SuRun user since the first beta of 1.2.0.9 version. Thanks Kay for this very good piece of software!

And now the question ;-) I have a BAT file (StartCMDAdmin.bat) with the following content:

@echo off
start c:\windows\system32\cmd.exe /t:17

Then I add this BAT file to the list of predefined programs that the user can run with elevated privileges. If the user browse to the location of this BAT file (i.e. C:\Tools) and executes it, then SuRun executes the BAT with Admin privileges and the user gets a command prompt where he "is admin".

Well, I'm trying to do this "on demand" (i.e. the user asks for having access to this BAT file) putting this file in a network share protected by ACL's. For example, imagine the user has mapped a share (net use t: \\server\share) and the BAT file is in t:\Tools.

Then I define T:\Tools\StartCMDAdmin.bat (SuRun complains "the command line doesn't seem to work") but if the user executes it, it starts a cmd.exe with normal privileges. Why?

If I create a second BAT file in C:\Tools (for example, StartConsole.bat) with the following content:

@echo off
start t:\tools\console.exe

and I try to execute it using SuRun, I get an error like this "The system can't find the specified controller" (sorry for the text but I've translated the spanish error. It seems that when SuRun raises the privileges of the user it can't access the network drive.

I suppose the first problem is something related with this second one.

Any idea about how to solve this? About how to have SuRun raise the privileges for files located in a network share? (I'm trying to do this because I can control access to these tools using AD groups in a more dynamic mode than modifying SuRun settings locally for an user, one by one).

Thank you very much.

Manel Rodero

PS: One more thing. The execution of the CMD from inside of the BAT file as admin only works if I check the option "create a hook in all processes ...". Why? Because the CMD is not using the user interface for starting the CMD? But, I've found that marking this option has some "problems" like SuRun trying to execute as admin some other proccesses not in the list (like the addition of a new driver when connecting a Nokia phone) ...
Kay (Administrator) #2
User title: Weltverbesserer
Member since Nov 2007 · 1508 posts · Location: Magdeburg
Group memberships: Administratoren, Mitglieder
Show profile · Link to this post
Hello Manel,

Quote by ManelR:
Any idea about how to solve this?

The cause of the problem is that Windows maps network drives for each user login.
SuRun creates a new login for the same user, but with admin rights.
But Windows does not map network drives for the SuRun-Admin login.

This is why you can't access T:\. It is just not mapped.

Quote by ManelR:
PS: One more thing. The execution of the CMD from inside of the BAT file as admin only works if I check the option "create a hook in all processes ...". Why?

cmd usually does not use the "Shell" to start a program. So SuRun's IShellExecute hook is not called.

Quote by ManelR:
But, I've found that marking this option has some "problems" like SuRun trying to execute as admin some other proccesses not in the list (like the addition of a new driver when connecting a Nokia phone) ...

Please give it a second try in SuRun 1.2.1.0b1. I've fixed the Hook code.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Not logged in. · Lost password · Register
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Page created in 54.6 ms (24.4 ms) · 44 database queries in 10.1 ms
Current time: 2019-08-23, 07:23:32 (UTC +02:00)