Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Runas with msiexec

Posted on 2004-10-11
3
Medium Priority
?
8,692 Views
Last Modified: 2013-11-14
Hello;

I am still rather new to the runas command, so any help would be greatly appreciated.

I would like to start an MSI install under a logon script.  The script that I have created is purely in test mode right now, however it does not work:

copy y:\install\NEWica32pkg.msi c:\docume~1\%username%\desktop\msifile.msi
path %path%;y:\install
runas /u:%computername%\Administrator "msiexec /i /package c:\docume~1\%username%\desktop\NEWica32pkg.msi"|sanur password
del c:\docume~1\%username%\desktop\sanur.exe
del c:\docume~1\%username%\desktop\NEWica32pkg.msi

When I run this script, everything seems to run fine, except when it gets to the msiexec statement.  I receive a window that states that the installation package could not be opened....  If I run the msiexec statement by it's self, then I do not receive an error.

The Sanur statement is a program that I found that will pipe in the password for runas.  If I remove the Sanur statement, it seems does not change the error.  


Any suggestions are greatly appreciated!

Thank you very much;

Rob

0
Comment
Question by:Rrech
  • 2
3 Comments
 
LVL 2

Expert Comment

by:Dudge669
ID: 12322059
> copy y:\install\NEWica32pkg.msi c:\docume~1\%username%\desktop\msifile.msi

You are copying the msi file to the desktop and renaming it to "msifile.msi" in the process but later when you call msiexec, you use the original filename of NEWica32pkg.msi.  Are you sure this script works fine without the runas?

If that was just a typo on your part, another thing to try is to provide the full path to msiexec which is usually:
%windir%\system32\msiexec.exe

Try using that ^^^^^^^ instead of just msiexec
0
 

Author Comment

by:Rrech
ID: 12323229
sorry that was a typo on my part.  NEWica32pkg was one of the apps that I was trying to push out.  I copied the script directly, then renamed the newica32pkg names to msi file.


I tried what you suggested with using the full path..... I still recieved the same error.




0
 
LVL 2

Accepted Solution

by:
Dudge669 earned 400 total points
ID: 12339029
Get the simple whoami.exe resource kit utility if you don't already have it....

http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/whoami-o.asp

As a test change your runas line to this and see if it loads correctly...

runas /u:%computername%\Administrator "%comspec% /k whoami"|sanur password

If that doesn't work you have an authentication problem.  What I have done in the past when loading msiexec as an admin is to load the entire batch file using runas instead of just the msiexec line.  That seems to work better from my experience.  Try getting rid of the runas stuff on your msiexec line and then run the whole batch file using runas.  Or make a small batch file with just the msiexec part and call it from another batch file with runas.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Screencast - Getting to Know the Pipeline

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question