Uninstalling software package

(imported topic written by mellis200091)

I am trying to write a task that will run an msiexec command to uninstall a software package. In my action script, I am able to stop the service, and I am able to run the msiexec command to uninstall, but that command doesn’t delete the files that are in the directory. As a result, I have a series of commands inserted to delete the files and remove the directories, but it doesn’t seem to work.

Here is my action script:

//Stop the existing Persystent Service wait net stop PersystentClient   
//Uninstall the actual program download http:
//patch.msad.unctv.org:52311/Uploads/1acb4b524ccd14db655eb0ce4673f8e4efe5ddbc/big140.tmp 

continue 

if 
{ (size of it = 2456418 and sha1 of it = 
"1acb4b524ccd14db655eb0ce4673f8e4efe5ddbc") of file 
"big140.tmp" of folder 
"__Download"
} extract big140.tmp wait 
"{pathname of system folder & "\msiexec
"}" /x 
"{(pathname of client folder of current site) & "\__Download\UNC-TVPersystentClient.msi
"}" /qn /norestart   
//Remove the old Persystent Files wait del /P /S /Q 
"C:\Program Files\Persystent\Service\*.*" wait rmdir /S /Q 
"C:\Program Files\Persystent\Service" wait rmdir /S /Q 
"C:\Program Files\Persystent\"   action requires restart

The part of the script that fails is at this line:

wait del /P /S /Q 
"C:\Program Files\Persystent\Service\*.*"

Does anyone know what is causing this to happen? When I run the command on the computer manually, it has no problem.

If anyone could suggest a fix for this, I would appreciate it!

Thanks,

Mike

(imported comment written by BenKus)

Hi Mike,

The “wait” command will execute an application, but these are shell commands you are looking for… try this instead to launch the cmd shell (and keep it hidden):

waithidden cmd.exe /C del /P /S /Q "C:\Program Files\Persystent\Service*.*"
waithidden cmd.exe /C rmdir /S /Q "C:\Program Files\Persystent\Service"
waithidden cmd.exe /C rmdir /S /Q “C:\Program Files\Persystent”

Ben

(imported comment written by mellis200091)

Thanks, Ben! I’ll try it out. I had expanded the deletion process, so I’m going to presume that the command "waithidden cmd.exe /C rmdir /S /Q “C:\Program Files\Persystent” will for all of it, because according to the help text for that command, it should delete the files and then remove the directory tree structure all in one command. I’ll let you know if my variation does the trick.

Thanks!

(imported comment written by mellis200091)

Another problem that I am having is that I have written a task to install a new version of the program that I described uninstalling in this topic thread. However, there appears to be something wrong with my relevance statement, because I’m not getting computers reporting it relevant even though it should be. Here is my relevance statement:

(name of operating system = "Win2000" OR name of operating system = "WinXP" OR name of operating system = "Win2003" OR name of operating system = "WinVista") AND ((version of file "PtcAgentSrv.exe" of folder "C:\Program Files\Persystent\Service" < ") or (not exists file "PtcAgentSrv.exe" of folder "C:\Program Files\Persystent\Service")) AND (exists file "msiexec.exe" of system folder)

What I am trying to have it accomplish is to confirm 1) the operating system matches, 2) that the file PtcAgentSrv.exe is either less then 4.3.168.1 or does not exist, and that 3) the msiexec.exe file exists in the system folder.

I’m pretty certain that my second condition in the relevance statement is the one that is the problem, but I just can’t get it to trigger correctly. Any thoughts?

Thanks,

Mike

(imported comment written by BenKus)

Try this:

(name of operating system = “Win2000” OR name of operating system = “WinXP” OR name of operating system = “Win2003” OR name of operating system = “WinVista”) AND ((not exists folder “C:\Program Files\Persystent\Service”) OR (not exists file “PtcAgentSrv.exe” of folder “C:\Program Files\Persystent\Service”) OR (version of file “PtcAgentSrv.exe” of folder “C:\Program Files\Persystent\Service” < ") ) AND (exists file “msiexec.exe” of system folder)

By reversing the order of the “OR” clause and first checking the existence of the folder and file, it fixes the issue…

Ben

(imported comment written by mellis200091)

Thanks, Ben. I’ll look at that in the morning!

(imported comment written by mellis200091)

Hey Ben,

When I put in the relevance statement you suggested, it filtered down quite a bit, but I am still getting some systems that have version 4.3.168.1 reporting back as relevant. I had previously put in a custom computer property statement called “Persystent Client Version” that reports back the value of the statement

version of file "PtcAgentSrv.exe" of folder "c:\Program Files\Persystent\Service"

, which I had tested using my relevance debugger program. That value for some of the computers that are listed as needing the new install package is reporting back as 4.3.168.1.

So, what am I missing here? I feel like I’ve put myself into a circular reference :slight_smile: I go from looking at the uninstall script to looking at the install script and back again.

Thanks,

Mike

(imported comment written by mellis200091)

I just had a revelation with this. I had noticed that the ones that were listing as relevant but were also listing as having 4.3.168.1 as the version of the package were ones that hadn’t reported back yet. I did a test and sent a wake-on-lan request to one of the computers, and when it reported back to the server, it took itself out of the task I have for installing version 4.3.168.1.

So, I think that solves my confusion on that point.

Thanks,

Mike