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

Share your tips or issues concerning the WAPT Console or WAPT Agent here
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Empbilly
Messages: 79
Registration: January 15, 2018 - 8:59 PM

September 27, 2018 - 5:12 PM

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

authority nt\system

Picture

https://ibb.co/iwCjWp (I do not know why the image does not appear being in the [img] tag)
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

September 27, 2018 - 5:48 PM

Hi Elias,
empbilly wrote: Sep 27, 2018 - 5:12 p.m. I did the tests and when I run a cmd via psexec it is as shown in the image below.

authority nt\system

Picture

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: Select all

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

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Empbilly
Messages: 79
Registration: January 15, 2018 - 8:59 PM

September 27, 2018 - 9:18 PM

dcardon,

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

Code: Select all

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 cannot 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?
User avatar
vcardon
WAPT Expert
Messages: 278
Registration: Oct 06, 2017 - 10:55 p.m.
Location: Nantes, France

September 28, 2018 - 3:07 PM

empbilly wrote: September 27, 2018 - 9:18 PM
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 cannot 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
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

September 28, 2018 - 3:24 PM

Hi Elias,
empbilly wrote: September 27, 2018 - 9:18 PM I got in touch with the company that developed the software and was given another variable to silently remove.

Code: Select all

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 cannot 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 uninstall was failing because the pop up windows was displayed on the non visible graphic buffer of "Local System".

Now you see why using

Code: Select all

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
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Empbilly
Messages: 79
Registration: January 15, 2018 - 8:59 PM

September 28, 2018 - 7:29 PM

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

It works!!! :D

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

The final script:

Code: Select all

# -*- 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!
Locked