Solved

Preparing a batch script to uninstall and reinstall a program

Posted on 2013-01-03
25
556 Views
Last Modified: 2013-02-06
Hi Experts,
we are running a client app on 100 numbers of windows server 2003 R2 64 bit, now an upgraded version comes and client asking us to do reinstall that on all those servers. Here is the text flowchart of that batch script which i m planning to create to automate this.
1. uninstall that program (but no user intervention is required).
2. Reboot the server.
3. install the latest version.
4. copy 3 config file to installed program directory (files are already there but the one we copying is upgraded one).
5. Reboot the server again.

But i got stuck on first point, i tried

msiexec /x path_app.msi /q

it does nothing, then i remove Quiet switch but now it is asking Yes/No option for removal

Please help..
0
Comment
Question by:pdixit1977
[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
  • 9
  • 9
  • 5
  • +1
25 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 38741198
Did you check the eventlog on the server you ran against with the /q flag to see what entry was in the event log for the msi installer source ?


This will help you know what happened when you ran with the /q flag so we can determine how to resolve this.
0
 

Author Comment

by:pdixit1977
ID: 38741242
i checked that and there is nothing in event logs..
0
 
LVL 29

Expert Comment

by:becraig
ID: 38741248
you may want to look into c:\temp on the target server to see if any logs were generated.

It seems the msi installer was not invoked if you are not seeing any msi entries in the eventlog.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Expert Comment

by:Neil Russell
ID: 38741258
Try using

msiexec /x path_app.msi /quiet
0
 

Author Comment

by:pdixit1977
ID: 38741297
Neilsr:
I would request you to please read my question carefully, i already did that but it not worked.


becraig:
No, there is no such logs in c:\temp too
0
 
LVL 29

Expert Comment

by:becraig
ID: 38741328
So I hate shooting in the dark but here are some options:

1. msiexec /x path_app.msi /qn
2. msiexec /x path_app.msi /l path to some logfile so we can see what is really up
3. msiexec /x path_app.msi /passive
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38741341
Why not add some logging to see what is going on, and perhaps use /passive for now instead of /quiet

msiexec /x app.msi /passive /log C:\temp\logfile.txt

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38741343
(Cross posted there with becraig)
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 38741912
/q is NOT /quiet the same, so you did not try that. There are slight differences.
0
 

Author Comment

by:pdixit1977
ID: 38743824
I tried
msiexec /x app.msi /passive /log C:\temp\logfile.txt

but it neither uninstalled the app NOR log something

msiexec /x path_app.msi /l path to some logfile  asking for user intervention yes/no

i already tried /q and /quiet but that also not worked for me..
0
 
LVL 29

Expert Comment

by:becraig
ID: 38743839
This is the strangest case I have ever heard, did the Application log on the computer this was run against show any msi installer entries for any of the commands you ran ?

Also please be sure to use verbose logging

msiexec /l*v
0
 

Author Comment

by:pdixit1977
ID: 38743855
msiexec /x app.msi /l*v C:\Appuninstalllogfile.txt

but its asking for user intervention yes/no
0
 
LVL 29

Expert Comment

by:becraig
ID: 38743866
also be sure to use either passive or /qb or /qn with this, e.g.

msiexec /x  /qb app.msi /l*v C:\Appuninstalllogfile.txt
msiexec /x  /qn app.msi /l*v C:\Appuninstalllogfile1.txt
msiexec /x  /passive app.msi /l*v C:\Appuninstalllogfile2.txt
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38743874
Odd!  /log should do the same as /l*v afaik?

is this one particular application btw, could always be that for some reason it won't allow/accept such uninstalls?

Does the msiexec task still continue running in task manager, or if you start it from cmd.exe does it return control straight away or show anything?

Steve
0
 
LVL 29

Expert Comment

by:becraig
ID: 38743892
Steve has a good point I would also try running the command from the command line on one of the servers to see what the command line returns.

As for what logging options exist and what does what, see below:
Windows Installer handles its installations through Msiexec.exe. The logging options offered by this tool allow you to create different types of logs, depending on the information you need about the installation. These options are:

    i - Status messages
    w - Nonfatal warnings
    e - All error messages
    a - Start up of actions
    r - Action-specific records
    u - User requests
    c - Initial UI parameters
    m - Out-of-memory or fatal exit information
    o - Out-of-disk-space messages
    p - Terminal properties
    v - Verbose output
    x - Extra debugging information
    + - Append to existing log file
    ! - Flush each line to the log
    * - Log all information, except for v and x options
0
 
LVL 29

Expert Comment

by:becraig
ID: 38743895
It might be possible the uninstall requires additional flags that we can pass into the command, more information would be required to accomplish this.
0
 

Author Comment

by:pdixit1977
ID: 38744541
Is it possible that an MSI package has some problem which not allowing it to run via command however it works if you install thru GUI ?
0
 

Author Comment

by:pdixit1977
ID: 38744549
i m saying it because i tried to install same app thru below command on another server

msiexec /i OpenSpanRuntimeEntSetup.msi /quiet /l* C:\Appuninstalllogfile.txt

and it says "the installation package could not be opened, verify that the package exist and you can access it"
0
 
LVL 29

Expert Comment

by:becraig
ID: 38744567
you get that error if the path to the msi is not reachable from the location the command is being called.

There are other potential issue but I think that is it, please ensure the msi is present in the location specified when running...

e.g. If running on a remote server copy the msi to c:\temp on that server then run via invoke-command or psexec msiexec c:\temp\file.msi
0
 

Author Comment

by:pdixit1977
ID: 38744677
i tried some other application installation and uninstallation with they way you guys suggest and they all were installed and uninstalled successfully but only this MSI giving error.

i m going back to client to ask another copy of MSI and also validate if they put any restrictions in code to not to install via command..

thanks for your help and i will update you soon..
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38744963
OK, good luck.
0
 

Author Comment

by:pdixit1977
ID: 38798684
As expected, that MSI file was having problem. Client gave me another MSI file which is working as yous suggested.
0
 
LVL 29

Accepted Solution

by:
becraig earned 125 total points
ID: 38799343
That sounds good, great to see you got it resolved.
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 125 total points
ID: 38799435
Good stuff. Are you OK with the rest of the scripting now then or still need help?  If so let us know the command lines of what IS working for you and which bits you still need help with.
Steve
0
 

Author Closing Comment

by:pdixit1977
ID: 38861239
thanks
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

623 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