Sign in to follow this  
Followers 0
loudguitar76

Running an .exe from a network share problem

8 posts in this topic

Hello,

I am new to using AUTOIT so if this has been answered before forgive me.

I can write a script that will run a file off the local HD as an admin with no problem, but as soon as i try to change the path to either UNC \\server\dfolder\file.exe or drive letter G:\file.exe it gives me a The dir name is invalid. The user i am using is an admin in the server that i am trying to pull this from.

Help

Thanks

Ben

Share this post


Link to post
Share on other sites



Hello,

I am new to using AUTOIT so if this has been answered before forgive me.

I can write a script that will run a file off the local HD as an admin with no problem, but as soon as i try to change the path to either UNC \\server\dfolder\file.exe or drive letter G:\file.exe it gives me a The dir name is invalid.  The user i am using is an admin in the server that i am trying to pull this from.

Help

Thanks

Ben

<{POST_SNAPBACK}>

Post your code. It is likely that in your code you are pointing to a particular file without specifying its exact path.

Share this post


Link to post
Share on other sites

Thanks For replying, my code is very basic.

$USERNAME = "admin"

$PASSWORD = "password"

RunAsSet($USERNAME, @ComputerName, $PASSWORD)

Run("\\server\departments\sdp121.exe")

RunAsSet()

Thanks

Ben

Also instead of running this as a local admin how can i run it as a domian admin, i have tried domain\userid and userid.domain.com

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks For replying,  my code is very basic.

$USERNAME = "admin"

$PASSWORD = "password"

RunAsSet($USERNAME, @ComputerName, $PASSWORD)

Run("\\server\departments\sdp121.exe")

RunAsSet()

Thanks

Ben

Also instead of running this as a local admin how can i run it as a domian admin, i have tried domain\userid and userid.domain.com

<{POST_SNAPBACK}>

There is the rub: You can not RunAsSet via a network share. (That is, unless this has been fixed since the last time I checked) I have bypassed this limitation by copying a file with the RunAsSet command to the PC which will be running the app, therefore it will run locally on that PC.

Generally, I actually create two files: one with the RunAsSet command which will then execute the second file when it finishes. The second file then deletes the file with the RunAsSet credentials in it. (Just in case anybody snoops and finds out the Admin password by going through the code. But I am a little paranoid. Your mileage may vary.)

Edited by SerialKiller

Share this post


Link to post
Share on other sites

Thanks,

So i can copy the file.exe and the 2nd script from a network share to say C:\ then run the said file as a local admin. and then call the second script to delete everything.

I dont have a problem doing it that way, but what is the code for adding arguments to the end of a file ( ie. app.exe /nodesk /upppp ) can i just run the file like that. We have recently taked locak admin rights from all our users so i am redoing every process i have.

Thanks for all the help , i appericaiate it.

Share this post


Link to post
Share on other sites

Thanks,

So i can copy the file.exe and the 2nd script from a network share to say C:\  then run the said file as a local admin. and then call the second script to delete everything. 

I dont have a problem doing it that way, but what is the code for adding arguments to the end of a file ( ie. app.exe /nodesk /upppp ) can i just run the file like that.  We have recently taked locak admin rights from all our users so i am redoing every process i have.

Thanks for all the help , i appericaiate it.

<{POST_SNAPBACK}>

First issue: User rights.

If you just copy the file to the C:\ drive, it is unlikely that the user will be able to execute it. By default, XP does not give users rights to execute files on the C:\ drive. I have bypassed this by adding a CACLS script within the RunAsSet to give users full rights to their C:\ drives but this could be a security risk.

So what I have been doing is dropping the files into their @Temp directories where they have rights to execute files.

As for the switches, you can add them on the end of your Run statement as you normally would using the Run... option.

I hope this helps. If not, ask someone smarter than me; they should not be too hard to find on this board.

Share this post


Link to post
Share on other sites

Yeah i agree, i can see where doing so can be a security risk, i like the idea of puttin it in the temp dir, i will give that a shot, thanks for the help.

Ben

Share this post


Link to post
Share on other sites

I run a compiled script off a share... just need certain permissions to do it. I forget exactly what I did, but im almost positive that just giving everyone read/execute and then making the folder the exe is in hidden would work.


Share this post


Link to post
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
Sign in to follow this  
Followers 0