Jump to content

RunAsSet and Network drives


slubitz
 Share

Recommended Posts

Hi all,

I read all the post's in the forum regarding problems with RunAsSet. But found no solution for the problem I have. ERROR: Unable to execute the external program

Some Information in advance:

The user I use has domain admin rights and is able to access the share and has lokal admin rights.

If someone could help me out, it would be great!

Here is the code:

$error = RunAsSet("adminuser","domainname","password",0)
MsgBox(0,"",$error);result is 1

;try to find out if I am able to write into the directory -> it is working
$error2= FileWriteLine("\\bies002\projekte\program\updates\sametime\test.txt","abc")
MsgBox(0,"",$error2);result is 1

RunWait("\\bies002\projekte\program\updates\sametime\sametimeclient651.exe")

RunAsSet()
Link to comment
Share on other sites

yes, i've got this problem too

ok, when i specify runasset, the environnement of the user on the machine is passed too

so the network drives are specifid to each users

example

if you want to execute a program where p: is a mapped to \\something

this map has to be added in the admin profile too

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

I have this problem, but will get a little more techincal with my description having done a fair bit of testing today.

okay I start the following test script:

RunAsSet ("isadmin", @ComputerName, "MyPassword")

$inst1 = 'notepad'

maph($inst1)

Exit

Func maph($a)

MsgBox (0, "Passed", $a)

Run ( 'subst h: c:\temp & ' & $a)

Run ( $a )

EndFunc

(you can change Subst for MapDrive or CMD Net use what ever, doesnt matter..

Following happens, Notepad runs and has no network drive. If I log into the computer and map a drive manually and then run the script from a user account, it works (obviously)

Okay, I then tried this one:

$inst1 = 'notepad'

maph($inst1)

Exit

Func maph($a)

MsgBox (0, "Passed", $a)

Run ( 'cmd /k subst h: c:\temp & ' & $a)

;Run ( $a )

EndFunc

waddya know it works H: drive and all...

From what I can see, although each command is from the RunAsSet with the same user, each command gets run in a new VM. If you make one VM and run all Programs from there, the network access stays...

If you go into windows and run the command prompt from start menu with runas and then type start cmd, it works and retains all the settings from the first. AutoIT doesn't..

The only way to get networks running via an AutoIT 3 script, is to map them as persistant in the User profile on the machine before running the script....kinda defeats the object of having scripts or?

Also, just a side note, why can I not launch and form of Explorer or IExplore from a RunAsSet script?

This is probably worth a bug report?

Link to comment
Share on other sites

I have this problem, but will get a little more techincal with my description having done a fair bit of testing today.

okay I start the following test script:

RunAsSet ("isadmin", @ComputerName, "MyPassword")

$inst1 = 'notepad'

maph($inst1)

Exit

Func maph($a)

MsgBox (0, "Passed", $a)

Run ( 'subst h: c:\temp & ' & $a)

Run ( $a )

EndFunc

(you can change Subst for MapDrive or CMD Net use what ever, doesnt matter..

Following happens, Notepad runs and has no network drive. If I log into the computer and map a drive manually and then run the script from a user account, it works (obviously)

Okay, I then tried this one:

$inst1 = 'notepad'

maph($inst1)

Exit

Func maph($a)

MsgBox (0, "Passed", $a)

Run ( 'cmd /k subst h: c:\temp & ' & $a)

;Run ( $a )

EndFunc

waddya know it works H: drive and all...

From what I can see, although each command is from the RunAsSet with the same user, each command gets run in a new VM. If you make one VM and run all Programs from there, the network access stays...

If you go into windows and run the command prompt from start menu with runas and then type start cmd, it works and retains all the settings from the first. AutoIT doesn't..

The only way to get networks running via an AutoIT 3 script, is to map them as persistant in the User profile on the machine before running the script....kinda defeats the object of having scripts or?

Also, just a side note, why can I not launch and form of Explorer or IExplore from a RunAsSet script?

This is probably worth a bug report?

ok ok ok

don't shoot autoit

for the explorer problem, its because of securities in Windosws

for example, try to run a shortcut to explorer with right clic/run as

=> nothing happens

for the UNC path :

you CAN'T run program with UNC path

if you want to use them, you have to map them

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

That's not correct. I can use the UNC path to run a program. If I dont use the RunAsSet command, the script is working with UNC. Anyway, it is also not running if I use a mapped drive and the RunAsSet command. By the way, where is the diference between W2k and XP? All of my Scripts with the RunAsSet function where running on W2k...........none of them on XP

Stefan

for the UNC path :

you CAN'T run program with UNC path

if you want to use them, you have to map them

Link to comment
Share on other sites

The funny thing is, that if I copy the Script file to the local harddrive, it is running.

For example:

In folder t:\updates (network share) I have a script runupdate.exe and program.exe. The Script (runupdate.exe) should start the program.exe with administrativ rights.

This is not working.

If I put runupdate.exe to the local drive and the program.exe stays on the t drive, it is working :whistle:

Link to comment
Share on other sites

mmm try to specify your @workingdir in your runwait command

i'd had so much trouble with run command too ^^

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

Hey, that did it......

Still I don't understand why this happens only with XP and why the RunWait fails, when I use the RunAs....

Realy strange :whistle:

Thanx arcker for the hint ;)

The Solution looks like this:

RunWait("\\server\share\program.exe","\\Server\share")

mmm try to specify your @workingdir in your runwait command

i'd had so much trouble with run command too ^^

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...