/build/static/layout/Breadcrumb_cap_w.png
12/07/2018 533 views

Hi,


I need VB Script to uninstall multiple old application version using product code and install newer version of it. Please help me cause i need to deploy through SCCM. 

0 Comments   [ + ] Show comments

Comments


All Answers

0

You do not need a vbscript.  you can do this in a batch file and call that for your distribution.

to remove all old software you just need to use that name instead of java in this examples:

wmic product where "name like '%%Java 7%%'" call uninstall

wmic product where "name like '%%Java%%7 Update%% (64-bit)%%'" call uninstall

Then add a line to install your software

Answered 12/07/2018 by: SMal.tmcc
Red Belt

  • I used to use this method but ended up shying away from Win32 product because it takes a while, is disk intensive and once in a while would corrupt installations of other programs. http://csi-windows.com/toolkit/win32product-replacement
    For MSI products I've switched to a powershell based method that looks for a displayname match in the Uninstaller portions of the registry, separates out the product GUID from the uninstallstring and then calls msiexec.exe /X {PRODUCTGUID} /qn (not all products like /norestart)

    Here is an example from my VirtualBox Install script. You could easily make this logic a bit more modular to handle an array, multiple found instances, arguments or a variable for the Display name.

    #Search the registry for present installs.
    $ProductInstalled = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
    Get-ItemProperty |
    Where-Object {$_.DisplayName -like "Oracle VM VirtualBox*"}

    # Remove present installs
    if ($ProductInstalled){

    If ($ProductInstalled.UninstallString) {
    $uninst = $ProductInstalled.UninstallString
    # strip away all but the product GUID, making it a value
    $UninstallGUID = $uninst -replace '"',"" -replace "msiexec.exe /X|MsiExec.exe /I"
    # Provide a list of arguments for MSIEXEC
    $UninstallArguments = "/x $UninstallGUID /qn /norestart"
    Start-Process -filepath msiexec.exe -argumentlist $UninstallArguments -wait
    }

    }
    • Thank you . But will how can i mention multiple application to uninstall and reinstall one application? sorry i am bad at scripting
      • This is a very tough thing to answer without more information as not all programs are Windows Installer(MSI based). There may also be ways to approach this that scale better depending upon your use case. What is the scope of work, how many applications, is this a one-time occurrence or will this be ongoing as newer versions of the products are released? How much experience with SCCM do you have? Depending upon your level of access to SCCM I would strongly encourage that you buy the following books and go through the exercises in them as they cover good practices and procedures. my guess is that you'll probably want to have software items for the programs you are targeting and then configure suprecedence within the software library. https://www.amazon.com/Stealing-Pride-Vol-Customizations-ConfigMgr/dp/9187445034/ref=sr_1_1?ie=UTF8&qid=1544469357&sr=8-1&keywords=stealing+with+pride https://www.amazon.com/System-Center-2012-Configuration-Manager-ebook/dp/B00MQ8YYD8/ref=sr_1_1?s=books&ie=UTF8&qid=1544469418&sr=1-1&keywords=deployment+fundamentals+SCCm