Jump to content

EXE uninstall


Recommended Posts

  • Developers

First part works ... Uninstall done. Dir does not get deleted though. 

Do you get an UAC prompt for the uninstall command?

If so then run then script with #RequireAdmin.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Definitely try #RequireAdmin since its a ProgramFiles change.

Also if files are still held open in the os briefly after uninstall it may fail, I have seen issues like that, usually they free up after a few seconds so you can try a loop of sorts.

Worst case though it may need a reboot or a manual close of files/services if that is what is blocking you.

$retrycount = 5

Do
    If FileExists(@ProgramFilesDir & "\OCS Inventory Agent\") Then
    DirRemove(@ProgramFilesDir & "\OCS Inventory Agent", 1)
    Sleep(2000)
    $retrycount -=1
Else
    ExitLoop
EndIf
Until $retrycount = 0
Edited by ViciousXUSMC
Link to comment
Share on other sites

  • Developers

Used #RequireAdmin but still not able to delete the folder.

No files open after uninstall..

The key here is whether or not the uninstall process is still running when you are doing the DirRemove() command.

This could happen when the RunWait() shelled program shells another process and ends.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Ok But this being Runwait the switch to Dirremove will happen once the previous is complete right?

In any case I am just running the code to delete folder independently but still no success

Yes BUT: let me try to explain in a little more detail what I tried to say in my last post:

You shell program UNINST.EXE from the OCS program directory and are waiting for it to finish.

It could very well be that this UNINST.exe program will start another uninstall program and then terminate.

The result would be that the "real" uninstall program is still running while the AutoIt3 script sees that the original shelled program ended.

Have you used the standard OCS installer and which version? (I have it also installed so could have a more details look later)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I can confirm what JOS said : the uninst.exe start a child process (name is AU_.exe on my system)

So this should work :

$iPID = Run ("C:\Program Files (x86)\OCS Inventory Agent\uninst.exe /s")
$iChlidProcess = ProcessWait("Au_.exe")
ProcessWaitClose($iChlidProcess)
DirRemove("C:\Program Files (x86)\OCS Inventory Agent", 1)

You can also use this king of code :

$iPID = Run ("C:\Program Files (x86)\OCS Inventory Agent\uninst.exe /s")
_ProcessWaitCloseRec($iPID)
DirRemove("C:\Program Files (x86)\OCS Inventory Agent", 1)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...