[SOLVED] The syntax for the file name... is incorrect

Share here your tips or issues concerning WAPT Console or WAPT Agent / Venez ici partager vos problèmes et astuces concernants la console et l'agent WAPT
Règles du forum
Règles du forum communautaire
* English support on www.reddit.com/r/wapt
* Le support communautaire en français se fait sur ce forum
* Merci de préfixer le titre du topic par [RESOLU] s'il est résolu.
* Merci de ne pas modifier un topic qui est taggé [RESOLU]. Ouvrez un nouveau topic en référençant l'ancien
* Préciser version de WAPT installée, version complète ET numéro de build (2.2.1.11957 / 2.2.2.12337 / etc.) AINSI QUE l'édition Enterprise / Discovery
* Les versions 1.8.2 et antérieures ne sont plus maintenues. Les seules questions acceptées vis à vis de la version 1.8.2 sont liés à la mise à jour vers une version supportée (2.1, 2.2, etc.)
* Préciser OS du serveur (Linux / Windows) et version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019)
* Préciser OS de la machine d'administration/création des paquets et de la machine avec l'agent qui pose problème le cas échéant (Windows 7 / 10 / 11 / Debian 11 / etc.)
* Eviter de poser plusieurs questions lors de l'ouverture de topic, sinon il risque d'être ignorer. Si plusieurs sujet, ouvrir plusieurs topic, et de préférence les uns après les autres et pas tous en même temps (ie ne pas spammer le forum).
* Inclure directement les morceaux de code, les captures d'écran et autres images directement dans le post. Les liens vers les pastebin, les bitly et autres sites tierces seront systématiquement supprimés.
* Comme tout forum communautaire, le support est fait bénévolement par les membres. Si vous avez besoin d'un support commercial, vous pouvez contacter le service commercial Tranquil IT au 02.40.97.57.55
empbilly
Messages : 79
Inscription : 15 janv. 2018 - 20:59

27 sept. 2018 - 17:12

I did the tests and when I run a cmd via psexec it is as shown in the image below.

authority nt\system

Image

https://ibb.co/iwCjWp (I do not know why the image does not appear being in the [img] tag)
Avatar de l’utilisateur
dcardon
Expert WAPT
Messages : 1364
Inscription : 18 juin 2014 - 09:58
Localisation : Saint Sébastien sur Loire
Contact :

27 sept. 2018 - 17:48

Hi Elias,
empbilly a écrit : 27 sept. 2018 - 17:12 I did the tests and when I run a cmd via psexec it is as shown in the image below.

authority nt\system

Image

https://ibb.co/iwCjWp (I do not know why the image does not appear being in the [img] tag)
So in that cmd.exe you are "Local System" (it is the real root account on Windows). Now you just need to run the same command line that you have put in your

Code : Tout sélectionner

setup.py
file and see if it is running properly.

Denis
Denis Cardon - Tranquil IT
Communiquez autour de vous sur WAPT! Envoyez nous vos url de blog et d'articles dans la catégorie votre avis du forum, nous les mettrons en avant sur le site WAPT
empbilly
Messages : 79
Inscription : 15 janv. 2018 - 20:59

27 sept. 2018 - 21:18

dcardon,

I got in touch with the company that developed the software and was given another variable to silently remove.

Code : Tout sélectionner

C:\ProgramData\{5F3A4BBA-1519-45F2-9BF7-1E9924E32CAA}>"Surfer(11.1.719)_Installer.exe" REMOVE=TRUE MODIFY=FALSE UNINSTALL=TRUE /s
When executing this command in cmd via psexec.exe another window is showing that they do not find a file or folder.

The window tells the message below:
C:\Windows\system32\config\systemprofile\Desktop refers to an unavailable location. It may be on a hard drive on these computers or on a network. Make sure the disk is inserted correctly or you are connected to the internet or the network and try again. If it still can not be found, the information may have been moved to another location.
Only after I press OK does the uninstall continue.

The path C:\Windows\system32\config\systemprofile exists, but "Desktop" no.

Would there be any way to simulate OK click?
Avatar de l’utilisateur
vcardon
Expert WAPT
Messages : 248
Inscription : 06 oct. 2017 - 22:55
Localisation : Nantes, FR

28 sept. 2018 - 15:07

empbilly a écrit : 27 sept. 2018 - 21:18
C:\Windows\system32\config\systemprofile\Desktop refers to an unavailable location. It may be on a hard drive on these computers or on a network. Make sure the disk is inserted correctly or you are connected to the internet or the network and try again. If it still can not be found, the information may have been moved to another location.
How about you create an empty folder C:\Windows\system32\config\systemprofile\Desktop in your install script ?

If your software uninstallation script wants to remove a file or a folder and it crashes because it doesn't find the file, then why not just create it.

WAPT is often useful to correct problems with commercial software installation/removal scripts.

Vincent
Vincent CARDON
Tranquil IT
Avatar de l’utilisateur
dcardon
Expert WAPT
Messages : 1364
Inscription : 18 juin 2014 - 09:58
Localisation : Saint Sébastien sur Loire
Contact :

28 sept. 2018 - 15:24

Hi Elias,
empbilly a écrit : 27 sept. 2018 - 21:18 I got in touch with the company that developed the software and was given another variable to silently remove.

Code : Tout sélectionner

C:\ProgramData\{5F3A4BBA-1519-45F2-9BF7-1E9924E32CAA}>"Surfer(11.1.719)_Installer.exe" REMOVE=TRUE MODIFY=FALSE UNINSTALL=TRUE /s
When executing this command in cmd via psexec.exe another window is showing that they do not find a file or folder.

The window tells the message below:
C:\Windows\system32\config\systemprofile\Desktop refers to an unavailable location. It may be on a hard drive on these computers or on a network. Make sure the disk is inserted correctly or you are connected to the internet or the network and try again. If it still can not be found, the information may have been moved to another location.
Only after I press OK does the uninstall continue.

The path C:\Windows\system32\config\systemprofile exists, but "Desktop" no.

Would there be any way to simulate OK click?
Like Vincent said previously, creating the C:\Windows\system32\config\systemprofile\Desktop folder before hand will probably do the trick. The uninstall script probably tries to remove an icon it had copied during installation to do some cleanup, but it fails miserably because the "Local System" user does not have such a folder (C:\Windows\system32\config\systemprofile\ is the value of %USERPROFILE% for "Local System"). And it explains why it was working when doing it in a user context.

In your case the unsinstall was failing because the pop up windows was display on the non visible graphic buffer of "Local System".

Now you see why using

Code : Tout sélectionner

psexec -i -s cmd.exe
is a good way to check the behavior of the installer.

The best thing would be for the developer to fix its install/uninstall script!

Cheers,

Denis
Denis Cardon - Tranquil IT
Communiquez autour de vous sur WAPT! Envoyez nous vos url de blog et d'articles dans la catégorie votre avis du forum, nous les mettrons en avant sur le site WAPT
empbilly
Messages : 79
Inscription : 15 janv. 2018 - 20:59

28 sept. 2018 - 19:29

hello vcardon and dcardon!! Thanks for the whole help!!!

It's works !!! :D

Had not thought about creating the folder to be later removed. 8-)

The final script:

Code : Tout sélectionner

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

uninstallkey = []

destdir = makepath(programfiles, "Golden Software", "Surfer 11")
exefile = "Surfer.exe"
inidir = "%s\\AppData\\Gradient.ini" % destdir
pstools = makepath(programfiles, "mspstools")

error_env = os.environ['WINDIR']
error_path = r'%s\system32\config\systemprofile\Desktop' % error_env

def install():
    if not os.path.isdir(error_path):
        os.makedirs(error_path)
    if os.path.exists(error_path):
        print("%s was success created!" % error_path)
    print('Uninstalling old versions of surfer...')
    for soft in installed_softwares("Surfer"):
        try:
            cmd = WAPT.uninstall_cmd(soft['key'])
            if isinstance(cmd,list) and len(cmd) == 1:
                cmd = cmd[0]
                if destdir and not 'UNINSTALL=YES' in cmd:
                    cmd = cmd + ' UNINSTALL=YES' + ' /s'
                    run(cmd)
            else:
                if not destdir and 'UNINSTALL=YES' in cmd:
                    run(cmd)
        except ValueError:
            pass
    print('Uninstalling old versions of Surfer completed!')
    print('Installing Surfer...')
    install_msi_if_needed('surfer.msi')
    if os.path.exists(destdir):
        filecopyto("Gradient.ini", "%s\\AppData" % destdir)
    if os.path.exists(inidir):
        print("Gradient.ini copied to the folder %s\\AppData" % destdir)
If you have something to improve on in the script, I'd be grateful for the suggestion. I am programming in python and I am still not aware of the best practices. Thank you!
Verrouillé