How to unistall Device Drivers via MSI with DPInst?

Hi all. I have a doubt a bout how to unistall device drivers via MSI.

We are now install the drivers via MSI using as custom action a VBScript and when we plug the device in it works perfectly but now we have a new problem. The problem is unistall those drivers.

When uninstalling we use a very similar VBScript as when installing, somethin like this:

Dim oShell
Dim source Set
oShell = CreateObject ("")
dir = oShell.ExpandEnvironmentStrings("%Temp%")
dir2 = oShell.ExpandEnvironmentStrings("%windir%")
source = dir + "\Device Drivers\"
dir2=  dir2 + "\system32\DRVSTORE\"
oShell.Run "cmd /k"+" cd"+" "+source+"DPInst_x86 & DPInst.exe /s /u "+" "+dir2+"toaster_4644C6CF04F87E5745CAF63D887EAACCF779346F\hpzid413.inf", vbhide

If we run this script manualy, it unistalls correclty  the Driver but when we try to run it from a CustomAction from the MSI when Removing the application.

We are not pretty sure of what sequence number set for that action on InstallExecuteSequence Table.

Well that´s our problem.  I hope some of you could help us.

Bye bye...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi, AlexIraMty

Any removal, uninstall, or deletion of files and registry keys as a custom action within an MSI, should always go just before "Install Finalize". Install finalize should always be your last marker for your custom actions, as custom actions will most likely not execute after install finalize action. If this script you wrote works when you execute it manually, just place it before install finalize and it should work.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Utilities

From novice to tech pro — start learning today.