Jump to content

Recommended Posts

Posted

Group,

I'm working on a script to automate the uninstall of an application. The application can only be uninstalled via the local administrator account and since I can't give this out to the user community, I was writing the script to use 'Runas' and then run the commands that are listed for this application in the registry. There is one key that I'm unsure of due to the number and usage of parameters, I could use a second set of eyes to make sure the syntax is correct. Below is the actual registry entry as it appears within the uninstall section:

C:\WINDOWS\Uninst.exe -a -f"C:\Program Files\UMS\DeIsL1.isu" -c"C:\Program Files\UMS\UI32DLLB.DLL"

Below is my code for handling it (and a few other lines):

RunAsSet("Administrator", @Computername, "Admin")

RunWait("C:\WINDOWS\Uninst.exe " & " -a -f C:\Program Files\UMS\DeIsL1.isu -c C:\Program Files\UMS\UI32DLLB.DLL",,@SW_HIDE)

ProcessClose("ums*")

ProcessClose("dllinit*")

ProcessClose("SHUTUSR")

RunWait(@ComSpec & " /c " & 'winmgmt /kill', "", @SW_HIDE)

RunAsSet()

The machines that I'm writing this for are all laptops for remote users, so I have no way to really test it and play with the code. The application is one of IBM's UMS management app's and has been known to cause issues due to memory leaks. Also, if anyone has had some experience with automating the uninstall of applications located within the Add/Remove programs applet, please feel free to pass along any tips you may have.

As always, thanks in advance.

ZK

Posted

Group,

    I'm working on a script to automate the uninstall of an application. The application can only be uninstalled via the local administrator account and since I can't give this out to the user community, I was writing the script to use 'Runas' and then run the commands that are listed for this application in the registry. There is one key that I'm unsure of due to the number and usage of parameters, I could use a second set of eyes to make sure the syntax is correct. Below is the actual registry entry as it appears within the uninstall section:

C:\WINDOWS\Uninst.exe -a -f"C:\Program Files\UMS\DeIsL1.isu" -c"C:\Program Files\UMS\UI32DLLB.DLL"

Below is my code for handling it (and a few other lines):

RunAsSet("Administrator", @Computername, "Admin")

RunWait("C:\WINDOWS\Uninst.exe " & " -a -f C:\Program Files\UMS\DeIsL1.isu -c C:\Program Files\UMS\UI32DLLB.DLL",,@SW_HIDE)

ProcessClose("ums*")

ProcessClose("dllinit*")

ProcessClose("SHUTUSR")

RunWait(@ComSpec & " /c " & 'winmgmt /kill', "", @SW_HIDE)

RunAsSet()

The machines that I'm writing this for are all laptops for remote users, so I have no way to really test it and play with the code. The application is one of IBM's UMS management app's and has been known to cause issues due to memory leaks. Also, if anyone has had some experience with automating the uninstall of applications located within the Add/Remove programs applet, please feel free to pass along any tips you may have.

As always, thanks in advance.

ZK

<{POST_SNAPBACK}>

There are two ways I'd try. First, rather than rebuild the uninstall string, how about:

$RWCmd = RegRead ( 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\YourProg', 'UninstallString' )
RunWait ( $RWCmd, '', @SW_HIDE )

The other thing is not using double quotes to define string variables. I'm trying to break this old habit myself, but it's great that AutoIt allows the use of a single quote to define a string so that you can use double quotes within the string. The RunWait call you posted is missing double quotes around directory names that contain spaces (Program Files). This should work too:

RunWait('C:\WINDOWS\Uninst.exe -a -f "C:\Program Files\UMS\DeIsL1.isu" -c "C:\Program Files\UMS\UI32DLLB.DLL"',,@SW_HIDE)

I don't think there's any need for the concatenating the string (&) since there are no variables involved. I've simply replaced the initial and last double quotes with single quotes, and used double quotes on any path that contains a space which is why C:\Windows\Uninst.exe doesn't need quotes around it.

Hope this helps.

Jerry

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
×
×
  • Create New...