Page 1 of 1

Uninstalling OFFICE 2013

Published: October 24, 2018 - 4:26 PM
by fbst
Hello everyone,

I am experiencing problems uninstalling OFFICE 2013 Standard via WAPT.
I've tried different ways to uninstall everything, but I can't manage it.

First, via the uninstallkey:
I retrieved the UID via wapt-get list-registry, which gave me quite a few, but when I try to uninstall it from PyScripter it doesn't work (return:

Code: Select all

Ligne de Commande : uninstall "C:\waptdev\Office2013Std_32bits-wapt\WAPT\.."
Uninstalling C:\waptdev\Office2013Std_32bits-wapt ...
None
Uninstallation done)
The uninstallkey looks like this:

Code: Select all

uninstallkey = ['{90150000-002A-0000-1000-0000000FF1CE}','{90150000-002A-040C-1000-0000000FF1CE}','Office15.STANDARD','Office2013Std_32bits','{90150000-0012-0000-0000-0000000FF1CE}','{90150000-001F-0401-0000-0000000FF1CE}','{90150000-001F-0407-0000-0000000FF1CE}','{90150000-001F-0409-0000-0000000FF1CE}','{90150000-001F-040C-0000-0000000FF1CE}','{90150000-001F-0413-0000-0000000FF1CE}','{90150000-001F-0C0A-0000-0000000FF1CE}','{90150000-002C-040C-0000-0000000FF1CE}','{90150000-006E-040C-0000-0000000FF1CE}','{90150000-00E1-040C-0000-0000000FF1CE}','{90150000-00E2-040C-0000-0000000FF1CE}']
I also tried using the uninstallstring, and I get the same message as with the uninstallkey:

Code: Select all

Ligne de Commande : uninstall "C:\waptdev\Office2013Std_32bits-wapt\WAPT\.."
Uninstalling C:\waptdev\Office2013Std_32bits-wapt ...
None
Uninstallation done)
The uninstallstring looks like this:

Code: Select all

uninstallstring =['"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe /uninstall Standard /config silent.xml"']
I tried using an uninstall() function that displays the contents of uninstallstring:

Code: Select all

def uninstall():
    print("Desinstallation d\'Office")
    run('"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe /uninstall Standard /config silent.xml"')
back:

Code: Select all

Ligne de Commande : uninstall "C:\waptdev\Office2013Std_32bits-wapt\WAPT\.."
Uninstalling C:\waptdev\Office2013Std_32bits-wapt ...
Desinstallation d'Office
2018-10-24 16:11:02,690 CRITICAL Fatal error in uninstall function: CalledProcessErrorOutput: Command '"C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\OFFICE15\\Office Setup Controller\\Setup.exe /uninstall Standard /config silent.xml"' returned non-zero exit status 1.
Output:Le chemin d'accÇùs spǸcifiǸ est introuvable.
:
Traceback (most recent call last):
  File "c:\wapt\waptpackage.py", line 1843, in call_setup_hook
    hookdata = hook_func()
  File "C:\waptdev\Office2013Std_32bits-wapt\setup.py", line 39, in uninstall
    run('"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe /uninstall Standard /config silent.xml"')
  File "c:\wapt\common.py", line 3317, in run
    return ensure_unicode(setuphelpers.run(*arg,pidlist=self.pidlist,**args))
  File "c:\wapt\setuphelpers.py", line 1044, in run
    raise CalledProcessErrorOutput(proc.returncode,cmd,''.join(output))
CalledProcessErrorOutput: Command '"C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\OFFICE15\\Office Setup Controller\\Setup.exe /uninstall Standard /config silent.xml"' returned non-zero exit status 1.
Output:Le chemin d'accŠs sp‚cifi‚ est introuvable.


FATAL ERROR : CalledProcessErrorOutput: Command '"C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\OFFICE15\\Office Setup Controller\\Setup.exe /uninstall Standard /config silent.xml"' returned non-zero exit status 1.
Output:Le chemin d'accÇùs spǸcifiǸ est introuvable.

Exit code:  3

The installation goes very well, it is completely transparent, the MSP file is in the right place, same for the silent.xml file.
When I run the following command in a shell, it works perfectly and silently....

Code: Select all

C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe /uninstall Standard /config silent.xml
I tried different things, I tried passing my paths via a variable in "raw":

Code: Select all

r"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe /uninstall Standard /config silent.xml" 
The result is the same, yet I thought I understood that the "r" or the act of surrounding the expression with "expression" escaped the spaces and slashes...
I also tried using the "pathlib" library, but it's not integrated into WAPT, and I couldn't get it to work.

I've included my entire setup.py file below in case it gives you some ideas, but there's nothing particularly original about it compared to the various topics on OFFICE that can be found in the forums :)
Thanks in advance!

fbst

Code: Select all

from setuphelpers import *
import time

windowspath64 = r"C:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Office Setup Controller"
windowspath32 = r"C:\Program Files\Common Files\microsoft shared\OFFICE15\Office Setup Controller"
waptpath = r"C:\waptdev\Office2013Std_32bits-wapt\Microsoft Office 2013 32bits"

if iswin64():
	uninstallstring =['"%s\Setup.exe /uninstall Standard /config silent.xml"',windowspath64]
else:
	uninstallstring =['"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\Office Setup Controller\Setup.exe /unininstall Standard /config silent.xml"']

def install():

    def killsoft():
      for soft in ('WINWORD.EXE','POWERPNT.EXE','EXCEL.exe','MSPUB.EXE','MSACCESS.EXE','INFOPATH.EXE','lync.exe','ONENOTE.EXE','OUTLOOK.EXE','ONENOTEM.EXE','MSOSYNC.EXE','GROOVE.EXE'):
        if isrunning(soft):
           print ("closing %s" % soft)
           killalltasks(soft)

    softname = 'Microsoft Office Professionnel Standard 2013'
    check_installed_out = installed_softwares(softname)
    if not check_installed_out:
            print('installing Office 2013')
            killsoft()
            cmd = ('%s\setup.exe /adminfile setup.msp /config silent.xml',waptpath)
            run(cmd,timeout=1200,accept_returncodes=[1641,3010,0])
            time.sleep(30)
            filecopyto("silent.xml",("C:\Program Files\Common Files\"))
    else:
            print('repair Office 2013')
            killsoft()
            cmd = '"C:\Program Files (x86)\Common Files\microsoft shared\OFFICE15\Office Setup Controller\setup.exe" /repair Standard /config silent.xml"'
            run(cmd,timeout=1200,accept_returncodes=[1641,3010,0])

Re: Uninstalling OFFICE 2013

Published: October 24, 2018 - 4:45 PM
by dcardon
Hello fbst,
fbst wrote: Oct 24, 2018 - 4:26 PM FATAL ERROR: CalledProcessErrorOutput: Command '"C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\OFFICE15\\Office Setup Controller\\Setup.exe /uninstall Standard /config silent.xml"' returned non-zero exit status 1.
Output: The specified access path could not be found.
....

Code: Select all

            filecopyto("silent.xml",("C:\Program Files\Common Files\"))
You need to specify the full path to the silent.xml file since it's not in the same directory as setup.exe. Alternatively, you need to define the working directory.

Sincerely,

Denis

Re: Uninstalling OFFICE 2013

Published: October 24, 2018 - 5:41 PM
by fbst
Good morning,

Thank you for the quick reply, I managed to find a starting point for a solution!
It works well locally on the server directly (installation/uninstallation)

Here is the code:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import time

uninstallkey = []
softname = 'Microsoft Office Standard 2013'

def install():

    def killsoft():
      for soft in ('WINWORD.EXE','POWERPNT.EXE','EXCEL.exe','MSPUB.EXE','MSACCESS.EXE','INFOPATH.EXE','lync.exe','ONENOTE.EXE','OUTLOOK.EXE','ONENOTEM.EXE','MSOSYNC.EXE','GROOVE.EXE'):
        if isrunning(soft):
           print ("Fermeture de %s" % soft)
           killalltasks(soft)

    if not installed_softwares(softname):
        open(makepath(programfiles32,'silent.xml'), "w" ).write(silentxml)
        print('Installation d\' Office 2013')
        cmd = '"C:\waptdev\Office2013Std_32bits-wapt\Microsoft Office 2013 32bits\setup.exe" /adminfile "setup.msp"'
        remove_file(makepath(programfiles32,'silent.xml'))
    else:
        print('Reparation d\'Office 2013')
        cmd = '"C:\waptdev\Office2013Std_32bits-wapt\Microsoft Office 2013 32bits\setup.exe" /repair Standard /config silent.xml"'


    killsoft()
    run(cmd,timeout=1200,accept_returncodes=[1641,3010,0])

    if not installed_softwares(softname):
            error('%s : clef de desinstallation non trouvée',softname)

def uninstall():
    open(makepath(programfiles32,'silent.xml'), "w" ).write(silentxml)
    print("Desinstallation d\'Office")
    run('"%s" /uninstall Standard /config "%s"' % (makepath(programfiles32,'Common Files','microsoft shared','OFFICE15','Office Setup Controller','Setup.exe'),makepath(programfiles32,'silent.xml')),timeout=1200)
    remove_file(makepath(programfiles32,'silent.xml'))

silentxml = ur"""<Configuration Product="Standard">
<Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />
   <Setting Id="SETUP_REBOOT" Value="NEVER" />
</Configuration>"""

However, once built and uploaded, when I try to install it on a remote machine, I get an error message:

Code: Select all

Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1374, in run
    self.running_task.run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 515, in run
    self._run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 960, in _run
    self.result.get('errors',[])))
Exception: Erreur lors de l'installation de [u'4C4C4544-0057-5810-8039-B8C04F534632(=2)']: erreurs dans les paquets [[u'4C4C4544-0057-5810-8039-B8C04F534632(=2)', PackageEntry(u'4C4C4544-0057-5810-8039-B8C04F534632',u'2') , u'Traceback (most recent call last):\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4372, in install\n    force=force\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 3591, in install_wapt\n    raise e\nEWaptUnavailablePackage: Missing dependencies: Office2013Std_32bits\n']]

Exception: Erreur lors de l'installation de [u'4C4C4544-0057-5810-8039-B8C04F534632(=2)']: erreurs dans les paquets [[u'4C4C4544-0057-5810-8039-B8C04F534632(=2)', PackageEntry(u'4C4C4544-0057-5810-8039-B8C04F534632',u'2') , u'Traceback (most recent call last):\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4372, in install\n    force=force\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 3591, in install_wapt\n    raise e\nEWaptUnavailablePackage: Missing dependencies: Office2013Std_32bits\n']]
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1374, in run
    self.running_task.run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 515, in run
    self._run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 960, in _run
    self.result.get('errors',[])))
Exception: Erreur lors de l'installation de [u'4C4C4544-0057-5810-8039-B8C04F534632(=2)']: erreurs dans les paquets [[u'4C4C4544-0057-5810-8039-B8C04F534632(=2)', PackageEntry(u'4C4C4544-0057-5810-8039-B8C04F534632',u'2') , u'Traceback (most recent call last):\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4372, in install\n    force=force\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 3591, in install_wapt\n    raise e\nEWaptUnavailablePackage: Missing dependencies: Office2013Std_32bits\n']]

Any ideas by any chance? :/

Thanks in advance,

Sincerely

Re: Uninstalling OFFICE 2013

Published: October 24, 2018 - 6:34 PM
by fbst
Further to my previous message, I would like to clarify that the fact that I specify the full path to setup.exe:

Code: Select all

cmd = '"C:\waptdev\Office2013Std_32bits-wapt\Microsoft Office 2013 32bits\setup.exe" /adminfile "setup.msp"'
This is because if I put setup.exe by itself, I get a message telling me that setup.exe is not found.
For your information, here is the directory structure of my package:
Capture.PNG
Capture.PNG (34.91 KB) Viewed 7288 times
The setup file is in the root directory, and I've also copied it to the WAPT folder and then to the Microsoft Office 2013 32-bit folder. So I'm having a little trouble understanding where the working directory of the Python script is... could someone please help me? :)

Could the fact that the path is hardcoded in the script be generating the above error?

Furthermore, to try and be as thorough as possible, here is my package displayed in the console:
Capture2.PNG
Capture2.PNG (31.03 KB) Viewed 7288 times
I get the message when I right-click on a host / Add a dependency / I check the package and then I click on launch installations.
(I'm mentioning this in case I make a mistake) :) )


Finally, here is the package's control file:
Capture3.PNG
Capture3.PNG (19.76 KB) Viewed 7288 times
Thank you so much... have a good evening

Re: Uninstalling OFFICE 2013

Published: October 25, 2018 - 7:45 PM
by dcardon
Good evening fbst,
fbst wrote: Oct 24, 2018 - 6:34 PM Further to my previous message, I would like to clarify that the fact that I specify the full path to setup.exe:

Code: Select all

cmd = '"C:\waptdev\Office2013Std_32bits-wapt\Microsoft Office 2013 32bits\setup.exe" /adminfile "setup.msp"'
This is because if I put setup.exe by itself, I get a message telling me that setup.exe is not found.
The setup.py script is executed in a temporary directory with a randomly generated directory name. If the installer needs a full execution path, I should be able to use something like:

Code: Select all

import os 
dir_path = os.path.dirname(os.path.realpath(__file__))
In your case:

Code: Select all

cmd = '"%s\setup.exe" /adminfile "%s\setup.msp"' % (dir_path,dir_path)
Sincerely,

Denis

Re: Uninstalling OFFICE 2013

Published: October 30, 2018 - 3:25 PM
by fbst
Good morning,

Sorry for the slightly long response time...
Thank you for your reply

After testing, it appears that this does not work any better:

I get this message when deploying the package on Windows 7 with Office 2010 installed:

Code: Select all

Installation d' Office 2013
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\common.py", line 3512, in install_wapt
    exitstatus = setup.install()
  File "c:\windows\temp\wapt83htmv\setup.py", line 23, in install
  File "C:\Program Files (x86)\wapt\common.py", line 3317, in run
    return ensure_unicode(setuphelpers.run(*arg,pidlist=self.pidlist,**args))
  File "C:\Program Files (x86)\wapt\setuphelpers.py", line 1044, in run
    raise CalledProcessErrorOutput(proc.returncode,cmd,''.join(output))
CalledProcessErrorOutput: Command '"c:\\windows\\temp\\wapt83htmv\\setup.exe" /adminfile "c:\\windows\\temp\\wapt83htmv\\setup.msp" /config "c:\\windows\\temp\\wapt83htmv\\silent.xml"' returned non-zero exit status -2146368439.
Output:
CalledProcessErrorOutput: Command '"c:\\windows\\temp\\wapt83htmv\\setup.exe" /adminfile "c:\\windows\\temp\\wapt83htmv\\setup.msp" /config "c:\\windows\\temp\\wapt83htmv\\silent.xml"' returned non-zero exit status -2146368439.
Output:
The MSP file is configured to uninstall older versions:

here is my code

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import os

dir_path = os.path.dirname(os.path.realpath('__file__'))

uninstallkey = []
softname = 'Microsoft Office Standard 2013'


def install():

    def killsoft():
      for soft in ('WINWORD.EXE','POWERPNT.EXE','EXCEL.exe','MSPUB.EXE','MSACCESS.EXE','INFOPATH.EXE','lync.exe','ONENOTE.EXE','OUTLOOK.EXE','ONENOTEM.EXE','MSOSYNC.EXE','GROOVE.EXE'):
        if isrunning(soft):
           print ("Fermeture de %s" % soft)
           killalltasks(soft)

    if not installed_softwares(softname):
        killsoft()
        print('Installation d\' Office 2013')
        cmd = '"%s\setup.exe" /adminfile "%s\setup.msp" /config "%s\silent.xml"' % (dir_path,dir_path,dir_path)
        run(cmd,timeout=1200,accept_returncodes=[1641,3010,0])
        killsoft()
    else:
        print('Deinstallation d\'office')
        cmd = '"%s\setup.exe" /uninstall Standard /config "%s\silent.xml"' % (dir_path,dir_path)
        run(cmd,timeout=1200,accept_returncodes=[1641,3010,0])


def uninstall():
    open(makepath(programfiles32,'silent.xml'), "w" ).write(silentxml)
    killsoft()
    print("Desinstallation d\'Office")
    run('"%s" /uninstall Standard /config "%s"' % (makepath(programfiles32,r'Common Files',r'microsoft shared','OFFICE15',r'Office Setup Controller','Setup.exe'),makepath(programfiles32,'silent.xml')),timeout=1200)
    remove_file(makepath(programfiles32,'silent.xml'))


The files setup.exe / setup.MSP / silent.xml are located in the root of the office package along with setup.py and all office folders.
I confess I'm having a little trouble understanding the problem I'm having :)

thanks in advance,

Sincerely



EDIT: and I confirm that a folder in windows/temp/XXXX is indeed created on the client machine, with all the office files present in the package on the server (setup.msp, setup.py, silent.xml + all the office folders)