Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Runas with msiexec

Posted on 2004-10-11
3
Medium Priority
?
8,651 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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 …
Starting up a Project

721 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