Danke, ich hatte also Recht.
Das erklärt aber nicht, warum meine Antwortdatei nicht erkannt wird.
Die Paketstruktur ist korrekt. Meine Konfigurationsdatei befindet sich tatsächlich im Stammverzeichnis und auf derselben Ebene wie setup.exe.
Unten ist meine setup.py-Datei, die ich nicht verändert habe. Sie stammt aus dem Originalpaket.
Eine Zeile bereitet mir jedoch noch Sorgen:
# TODO "setup.exe /customize configuration.xml if up-to-date" Muss ich nach dem Einfügen meiner Datei noch etwas tun, z. B. das Paket neu erstellen oder packen?
Datei setup.py
# -*- coding: utf-8 -*-
from setuphelpers import *
import tempfile
"""
Resources:
https://config.office.com/deploymentsettings
https://admx.help/?Category=Office2016& ... heOverride
https://admx.help/?Category=Office2016& ... celfilesas
"""
app_uninstallkey = "O365ProPlusRetail - fr-fr"
def install():
# Deklarieren lokaler Variablen
package_version = control.get_software_version()
silentflags = "/configure configuration.xml"
# Deinstallieren älterer Office-Versionen bei Bedarf
uninstall_mso2013_if_needed("Office15.STANDARD")
uninstall_mso2016_if_needed("Office16.STANDARD")
# Deinstallieren anderer Office-Versionen bei Bedarf
uninstall_other_office_edition(app_uninstallkey.split(" ")[0])
# Installieren der software
install_exe_if_needed(
"setup.exe",
silentflags=silentflags,
timeout=1200,
accept_returncodes=[1641, 3010, 0],
key=app_uninstallkey,
min_version=package_version,
)
# TODO "setup.exe /customize configuration.xml if up-to-date"
# Hinzufügen des Befehls für die stille Deinstallation
quiet_uninstall = installed_softwares(uninstallkey=app_uninstallkey)[0]["uninstall_string"] + " DisplayLevel=False"
if "OfficeClickToRun.exe" in quiet_uninstall:
register_uninstall(
uninstallkey=app_uninstallkey,
quiet_uninstall_string=quiet_uninstall,
)
def session_setup():
print("Deaktivierung: MSO-Telemetrie")
#
https://admx.help/?Category=Office2016& ... plications
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "wdsolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "xlsolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "pptsolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "olksolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "accesssolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "projectsolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "publishersolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "visiosolution", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedapplications", "onenotesolution", 1)
#
https://admx.help/?Category=Office2016& ... utionTypes
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedsolutiontypes", "documentfiles", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedsolutiontypes", "templatefiles", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedsolutiontypes", "comaddins", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedsolutiontypes", "appaddins", 1)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm\preventedsolutiontypes", "agave", 1)
#
https://admx.help/?Category=Office2016& ... bleLogging
# registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm", "enablelogging", 0)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm", "enableupload", 0)
registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\osm", "enablefileobfuscation", 1)
# #
https://admx.help/?Category=Office2016& ... entoptions
# registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\common\internet", "useonlinecontent", 0)
# #
https://admx.help/?Category=Office2016& ... velOptions
# registry_set(HKEY_CURRENT_USER, r"software\policies\microsoft\office\16.0\common\internet", "serviceleveloptions", 0)
def uninstall_other_office_edition(edition_uninstallkey):
# Variablen initialisieren
silent_uninstall_file_path = makepath(tempfile.gettempdir(), "remove_other_office.xml")
uninstall_configuration_xml_content = r"""
<Remove All="TRUE">
</Remove>
<Display Level="none" CompletionNotice="No" SuppressModal="Yes" AcceptEula="Yes" />
<Setting Id="SETUP_REBOOT" Value="Never" />
<Setting Id="REBOOT" Value="ReallySuppress"/>
</Configuration>
"""
# XML
mit open(silent_uninstall_file_path, "w") as xml_file ändern:
xml_file.write(uninstall_configuration_xml_content)
killalltasks(control.get_impacted_process_list())
# Office deinstallieren, falls erforderlich
for to_uninstall in installed_softwares():
if ("OfficeClickToRun.exe" in to_uninstall["uninstall_string"]) and not (edition_uninstallkey in to_uninstall["key"]):
print("Entferne: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
app_uninstall_cmd = to_uninstall["uninstall_string"] + " DisplayLevel=False"
run(app_uninstall_cmd)
wait_uninstallkey_absent(to_uninstall["key"])
def uninstall_mso2016_if_needed(uninstallkey):
# Initialisierung der Variablen
silent_uninstall_file_path = makepath(tempfile.gettempdir(), "remove_o2016.xml")
uninstall_configuration_xml_content = r"""
<Remove All="TRUE">
</Remove>
<Display Level="none" CompletionNotice="No" SuppressModal="Yes" AcceptEula="Yes" />
<Setting Id="SETUP_REBOOT" Value="Never" />
<Setting Id="REBOOT" Value="ReallySuppress"/>
</Configuration>
"""
# XML
mit open(silent_uninstall_file_path, "w") as xml_file modifizieren:
xml_file.write(uninstall_configuration_xml_content)
# Office deinstallieren, falls erforderlich
for to_uninstall in installed_softwares(uninstallkey=uninstallkey):
print("Entferne: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
killalltasks(control.get_impacted_process_list())
if "OfficeClickToRun.exe" in to_uninstall["uninstall_string"]:
app_uninstall_cmd = to_uninstall["uninstall_string"] + " DisplayLevel=False"
run(app_uninstall_cmd)
wait_uninstallkey_absent(to_uninstall["key"])
else:
run(to_uninstall["uninstall_string"] + ' /config "%s"' % silent_uninstall_file_path)
wait_uninstallkey_absent(to_uninstall["key"])
def uninstall_mso2013_if_needed(uninstallkey):
# Variablen initialisieren
silent_uninstall_file_path = makepath(tempfile.gettempdir(), "remove_o2013.xml")
uninstall_configuration_xml_content = r"""
<Remove All="TRUE">
</Remove>
<Display Level="none" CompletionNotice="No" SuppressModal="Yes" AcceptEula="Yes" />
<Setting Id="SETUP_REBOOT" Value="Never" />
<Setting Id="REBOOT" Value="ReallySuppress"/>
</Configuration>
"""
# XML
mit open(silent_uninstall_file_path, "w") as xml_file modifizieren:
xml_file.write(uninstall_configuration_xml_content)
# Office deinstallieren, falls erforderlich
for to_uninstall in installed_softwares(uninstallkey=uninstallkey):
print("Entferne: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
killalltasks(control.get_impacted_process_list())
run(to_uninstall["uninstall_string"] + ' /config "%s"' % silent_uninstall_file_path)
wait_uninstallkey_absent(to_uninstall["key"])