Sign in to follow this  
Followers 0
zandztrom

Wrong folder when using RunAsSet()...

12 posts in this topic

#1 ·  Posted (edited)

Trying to run the following script wich used to work without a problem.

RunAsSet("account", "domain", "password")

RunWait('msiexec /x {A149DEA2-1D5B-11D5-9F76-00C04F6BC7A1} /qb', @SystemDir)

FileCopy("\\servername\Program\office\Program\ARC\8.3.0.00\autosetup.cfg", "D:\autosetup.cfg")

RunWait('msiexec /i "\\servername\Program\office\Program\ARC\8.3.0.00\LicensFix\ArcViewLic.msi" /qb', @SystemDir)

Run('\\servername\Program\office\Program\ARC\8.3.0.00\Reboot.EXE /s')

RunAsSet()

Now i get an error dialogue saying:

Line 0 (File "\\servername\Program\office\Program\ARC\8.3.0.00\ArcView.exe"):

Run('\\servername\Program\office\Program\ARC\8.3.0.00\Reboot.EXE /s')

Error: Unable to execute the external program.

The Folder name is incorrect. <--- (this line is in swedish so i translated it as close as possible, there is nothing wrong with the path since I can run it on cmd line). Does anyone have a clue about what can be wrong?

Edited by zandztrom

Share this post


Link to post
Share on other sites



Trying to run the following script wich used to work without a problem.

RunAsSet("account", "domain", "password")

RunWait('msiexec /x {A149DEA2-1D5B-11D5-9F76-00C04F6BC7A1} /qb', @SystemDir)

FileCopy("\\servername\Program\office\Program\ARC\8.3.0.00\autosetup.cfg", "D:\autosetup.cfg")

RunWait('msiexec /i "\\servername\Program\office\Program\ARC\8.3.0.00\LicensFix\ArcViewLic.msi" /qb', @SystemDir)

Run('\\servername\Program\office\Program\ARC\8.3.0.00\Reboot.EXE /s')

RunAsSet()

Now i get an error dialogue saying:

Line 0 (File "\\servername\Program\office\Program\ARC\8.3.0.00\ArcView.exe"):

Run('\\servername\Program\office\Program\ARC\8.3.0.00\Reboot.EXE /s')

Error: Unable to execute the external program.

The Folder name is incorrect. <--- (this line is in swedish so i translated it as close as possible, there is nothing wrong with the path since I can run it on cmd line)

i´m not shure but i had a similar problem, runasset seems not to work over the network (unc or drivemapping)

in my script i made only changes to lokalpathes instead of networkpathes and it worked


das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Share this post


Link to post
Share on other sites

i´m not shure but i had a similar problem, runasset seems not to work over the network (unc or drivemapping)

in my script i made only changes to lokalpathes instead of networkpathes and it worked

The strange thing is that the previous unc paths works fine and so did this one to until recently.

It's also just like the RunAsSet() lost it's "RunAs capabilities".

Share this post


Link to post
Share on other sites

The strange thing is that the previous unc paths works fine and so did this one to until recently.

It's also just like the RunAsSet() lost it's "RunAs capabilities".

Second error first, try setting the working dir to @SystemDir

Run('\\servername\Program\office\Program\ARC\8.3.0.00\Reboot.EXE /s', @SystemDir)

For the first problem, try testing access to the server by using RUNAS to open a command prompt with your domain account

i.e runas /user:domain/account cmd

and then net use \\servername\Program

AFAIK, AutoIT uses the same underlying subsystem for RunAsSet so if RUNAS works then RunAsSet should work as well.

Share this post


Link to post
Share on other sites

Second error first, try setting the working dir to @SystemDir

Run('\\servername\Program\office\Program\ARC\8.3.0.00\Reboot.EXE /s', @SystemDir)

For the first problem, try testing access to the server by using RUNAS to open a command prompt with your domain account

i.e runas /user:domain/account cmd

and then net use \\servername\Program

AFAIK, AutoIT uses the same underlying subsystem for RunAsSet so if RUNAS works then RunAsSet should work as well.

Thank's a lot...

It worked just fine when I put @systemdir just as you said. But how could it work before?

Best regards

Share this post


Link to post
Share on other sites

This is an issue I have been struggling with for a while.

Zandztrom, are you sure the script works now? Are you sure that it's because of the @systemdir, or could it be because you did a Net use in CMD and the session is still connected.

My workaround for this problem has been to have autoit do the runas but most of the cmd line work is being done by invoking a bat file. Pretty primitive, i know, but it's been the most reliable way for me to patch our Systems here.

Alternatively, you can run a cmd remotely by using the PStools utility (which are priceless even though they are free).

I haven't tried the @systemdir option, but I dont see why that would solve your problem unless you are mapped to the network share (which would have nothing to do with @systemdir).

-confuzzled monkey


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

I'm having the same issue. I need to run a .msi with a custom transforms file, but I need to use RunAsSet to run with elevated permissinos. I can successfully run the following command from a batch file in the same directory as the installation files:

msiexec /i LotusNotes654.mis /qb TRANSFORMS=nd65-desktopPC.mst

However, when I try to run it in an AutoIT script using RunAsSet, as follows:

RunAsSet("account", "domain", "password")

Run ("msiexec /i LotusNotes654.msi /qb TRANSFORMS=nd65-desktopPC.mst")

RunAsSet( )

... I get:

Line 0 (File "I:\Notes\remoteInstallND654\upgradeScript.exe"):

Run("msiexec /i LotusNotes654.msi /qb TRANSFORMS=nd65-desktopPC.mst")

Error: Unable to execute the external program.

The directory name is invalid.

I tried calling the batch file, which I can run from a command line with my credentials using:

RunAsSet("account", "domain", "password")

Run ("remote.bat")

RunAsSet( )

... I get:

Line 0 (File "I:\Notes\remoteInstallND654\upgradeScript.exe"):

Run("remote.bat")

Error: Unable to execute the external program.

The directory name is invalid.

I tried adding adding @SystemDir, but that did not resolve it....

Any suggestions/guidance would be greatly appreciated, I am completely new to AutoIT scripts....

Thanks,

Gigot

Share this post


Link to post
Share on other sites

When you use RunAsSet(), you are logging into the local machine as another user, maybe admin. In the secondary login, you are not logged into the network. You must reauthenicate a user with permissions to the share in the secondary login. With windows, if you are using the local admin account and that password is the same as the domain admin then it might work fine. With novell, you must run login32.exe in the secondary login.

Share this post


Link to post
Share on other sites

Thanks for the reply. I'm not sure I understand. So the RunAsSet command authenticates on the local PC with the credentials I supplied. They happen to be an account that is in local Administrators group on the PC. But then I have to somehow reauthenticate on the file server where the script and installation files are located using the credentials I supplied in the RunAsSet command? How do I do that? (It's a Windows file server and we're running Windows Active Directory).

...thanks again for any assistance.

Gigot

Share this post


Link to post
Share on other sites

I've had this problem only since upgrading to AutoIt 3.1.1. I had no problems with other 3.x versions. I had a short script compiled in an older version and using the runasset command worked fine; with no other changes, I recompiled it today with v3.1.1 and then got the same error as mentioned above. Adding the @systemdir as the working directory worked for me.

I assume that works because @systemdir is the location of the windows runas.exe command??? Anyone know if that is correct?

Share this post


Link to post
Share on other sites

I've had this problem only since upgrading to AutoIt 3.1.1. I had no problems with other 3.x versions. I had a short script compiled in an older version and using the runasset command worked fine; with no other changes, I recompiled it today with v3.1.1 and then got the same error as mentioned above. Adding the @systemdir as the working directory worked for me.

OK apparently I spoke too soon. It worked for my on one computer but did not work on another windows XP machine....

Share this post


Link to post
Share on other sites

When you use RunAsSet(), you are logging into the local machine as another user, maybe admin. In the secondary login, you are not logged into the network. You must reauthenicate a user with permissions to the share in the secondary login. With windows, if you are using the local admin account and that password is the same as the domain admin then it might work fine. With novell, you must run login32.exe in the secondary login.

Exactly. If you wish to use RunAsSet and access network resources, create two scripts, one which maps a network drive (with the desired network credentials) to the network share and then runs the network located EXE, and a second script that calls RunAsSet then runs the first script...


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

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