Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have to constantly switch back and forth between two installations of a web app with two different versions of an ActiveX control. Therefore I'd like to script the ability to uninstall this control. Its does not show up in Win32_Product because it was not installed via windows installer, and contrary to this answer, the Win32_ClassicCOMClass does not contain this ActiveX control.

AXHelper shows the control in HKEY_CLASSES_ROOT\CLSID. So my two questions are:

  • How do I enumerate the control with WMI
  • How do I uninstall the control with WMI
share|improve this question

1 Answer 1

You can usually find the activex ocx file in C:\windows\Downloaded Program Files.

To uninstall use cmd in powershell as cmd /c 'regsvr32 /u "C:\windows\Downloaded Program Files\youractivex.ocx"

Use $lastexitcode to verify success

Once it's uninstalled remove the ocx file from the downloaded program files folder and copy in the ocx file for the different version then install just as the uninstall command but without the /u

share|improve this answer
    
James, the program is not stored there, but I know where it is. I will try this later today. –  Justin Dearing Jul 20 '11 at 13:05
    
That uninstalls the OCX, but does not remove it from the Programs and Features (Add Remove Programs on XP and previous). –  Justin Dearing Jul 25 '11 at 12:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.