Sign in to follow this  
Followers 0
Agent Orange

RunAs install with an MSI

18 posts in this topic

#1 ·  Posted (edited)

I'm trying to run an msi as the local admin on the PC. I'm getting an error from msi about an incorrect parameter. Here is the code. Any ideas?

RunAsSet("administrator", @ComputerName, "password")
Run("msiexec /i \\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi","")
RunAsSet()

Thanks

Edited by Agent Orange

Share this post


Link to post
Share on other sites



I'm trying to run an msi as the local admin on the PC. I'm getting an error from msi about an incorrect parameter. Here is the code. Any ideas?

RunAsSet("administrator", @ComputerName, "password")
Run("msiexec /i \\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi","")
RunAsSet()

Thanks

Doubt if this ever will work because I expect the Local admin doesn't have the rights to get the file from \\server .. ?

use ifadmin

Maybe follow your own advice ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Maybe it's space in a path... Try this

RunAsSet("administrator", @ComputerName, "password")
Run('msiexec /i "\\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi"','')
RunAsSet()

Share this post


Link to post
Share on other sites

Maybe it's space in a path... Try this

RunAsSet("administrator", @ComputerName, "password")
Run('msiexec /i "\\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi"','')
RunAsSet()
You love those quotes dont you? Lol.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I have couple things to say here. Why are you trying to run the MSI as any user? As I understand it, when you launch an MSI, the Windows Installer service is started which then performs the installation as the Local System account. So what are you trying to achieve by running as Administrator?

Second, assuming the Administrator account can actually see the network share (As JdeB already pointed out), your working directory is probably the problem. You are not explicitly setting the working directory when you call Run() which means it is automatically set to @WorkingDir. If Administrator does not have access rights to be in the working directory, then Run() will fail. If you are running the script from the Desktop or anywhere in the user's profile area, the Administrator account can not access those folders. When using RunAsSet(), always always always set the working directory in any subsequent Run()/RunWait() calls, even if you just set it to @WindowsDir or the system root.

Share this post


Link to post
Share on other sites

I'm trying to run an msi as the local admin on the PC. I'm getting an error from msi about an incorrect parameter. Here is the code. Any ideas?

RunAsSet("administrator", @ComputerName, "password")
Run("msiexec /i \\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi","")
RunAsSet()

Thanks

Sir , This will never work, u need to copy the source files to local machine to work with the administrator.

Thanks

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Sir , This will never work, u need to copy the source files to local machine to work with the administrator.

Thanks

You can have wide open share(Everyone:Full Control).

Edited by Joon

Share this post


Link to post
Share on other sites

You love those quotes dont you? Lol.

i have the same problem with runasset and runwait functions, how to change the workingdir .

Aqeel

Share this post


Link to post
Share on other sites

Read the documentation?

Share this post


Link to post
Share on other sites

I'm trying to run an msi as the local admin on the PC. I'm getting an error from msi about an incorrect parameter. Here is the code. Any ideas?

RunAsSet("administrator", @ComputerName, "password")
Run("msiexec /i \\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi","")
RunAsSet()

Thanks

Filecopy("\\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi", @tempdir & "\Misys Laboratory v6.1.0120.msi", 0)

If Not IsAdmin() Then

RunAsSet("administrator", @ComputerName, "password")

EndIf

RunWait('msiexec /i "' & @tempdir & '\Misys Laboratory v6.1.0120.msi"', @TempDir)

RunAsSet()

Filedelete(@tempdir & "\Misys Laboratory v6.1.0120.msi")

Share this post


Link to post
Share on other sites

Filecopy("\\server\VOL1\Snaps\WinXP\XP_Misys Laboratory\v6.1.0120\Misys Laboratory v6.1.0120.msi", @tempdir & "\Misys Laboratory v6.1.0120.msi", 0)

If Not IsAdmin() Then

RunAsSet("administrator", @ComputerName, "password")

EndIf

RunWait('msiexec /i "' & @tempdir & '\Misys Laboratory v6.1.0120.msi"', @TempDir)

RunAsSet()

Filedelete(@tempdir & "\Misys Laboratory v6.1.0120.msi")

@tempdir could be different for the RunAs credentials so this might fail ...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@tempdir could be different for the RunAs credentials so this might fail ...

$CheckAdminPwd = RunAsSet("Administrator", @Computername, "adfdfsdf")

$SoftSuccessFlag = RunWait("c:\temp\bentley\pre\setup.exe /Q")

i m getting this error pls help

>Running:(3.2.0.1):C:\Program Files\AutoIt3\autoit3.exe "Z:\ZENAPPS\Bentley1\Pre\test5.au3"

Z:\ZENAPPS\Bentley1\Pre\test5.au3 (2) : ==> Unable to execute the external program.:

$SoftSuccessFlag = RunWait("c:\temp\bentley\pre\setup.exe /Q")

The directory name is invalid.

If i use jusr runwait it works great.but if i run along with runasset then i m getting this error msg

Pls Help

Aqeel

maqeel@gartnerlee.com

Share this post


Link to post
Share on other sites

You did not put the workingdir in your RunWait() as advised ... ;)

Thnks JdeB, i did try putting the workingdir stilll the same. Could you pls show me where to add the workingdir in runwait. pls.

$CheckAdminPwd = RunAsSet("Administrator", @Computername, "adfdfsdf")

$SoftSuccessFlag = RunWait("c:\temp\bentley\pre\setup.exe /Q")

>Running:(3.2.0.1):C:\Program Files\AutoIt3\autoit3.exe "Z:\ZENAPPS\Bentley1\Pre\test5.au3"

Z:\ZENAPPS\Bentley1\Pre\test5.au3 (2) : ==> Unable to execute the external program.:

$SoftSuccessFlag = RunWait("c:\temp\bentley\pre\setup.exe /Q")

The directory name is invalid.

Share this post


Link to post
Share on other sites

RunWait("c:\temp\bentley\pre\setup.exe /Q","c:\temp\bentley")

;)

Thanks Jdeb, It worked the way u had shown.

Just to share with you it also worked after i changed the workingdir location using the following syntax

FileChangeDir("C:\temp\bentley\pre\").

Once Again thanks a lot ,

Aqeel

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