Link to home
Start Free TrialLog in
Avatar of Brian
BrianFlag for United States of America

asked on

Remove IE9 using WMI

Hello Experts,

I would like to know if it's possible to write code using WMI and somehow tie that to a link on a web page for a user to click on in order to run the WMI code. The reason I ask is because I support 500+ employees and we use a web app that is only compatible with IE8 and lately IE9 has been included in Windows Update. So rather than get flodded with calls I was wondering if it could be handled by having the user navigate to a page and click on a link to execute the code. I have never written code using WMI but from what I have read this is what I should be using.

Requirments:
  - User clicks on link from internal website.
  - Code needs to check to first see if IE9 is installed. If so, continue to remove if not, display message that IE9 is not installed.

Also, users have Windows XP, 7x32 and 7x64 installed. I don't believe IE9 works with XP so I should only need the code to work with 7x32 and 7x64.

I'm using ASP.NET 4.0 and C#.

Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brian

ASKER

Hi sedgwick,

Ok, thank you.

Should I wrap the code above into the ButtonClick Event?

Also, I don't fully understand the .bat file would you be able to copy/paste that for me into a .txt file and then I can rename it myself?

Where do I store the .bat file at on my end and how do I reference that in the code?
I'm sorry i didn't fully understand your requirements till now.

since u want to uninstall ie9 from the client machine u can't really use this code (it's server side).
as a whole, accessing local machine from client is a security breach even if it's trusted zone and so on (scripts run in a sandbox in which they can only perform web-related actions).
u can download some plugins which requires to dropping most of the browser security and even so they are not reliable.

so basically it's impossible and for a good reason.
you can write an IE ActiveX control to do that but i wouldn't recommend this approach.

what you should do is notify users that IE9 is not supported and let them download a batch/script which downgrade their browser to IE8.
the alternative is to use xcopy to copy batch file to all end-users machines and run it to downgrade the IE version.
you can use powershell to copy the script to a network share and run it from there as well.
Avatar of Brian

ASKER

Hi sedgwick,

Ok. Is it still possible to use the .bat file from the link that you sent me and then I can post the .bat file into a .zip folder and then the client can download and extract the .bat file and run it from their local computer?

If so, can you help me with the .bat file from the link you sent me? This way we are not running it from the browser but instead downloading it into a .zip file.

Thanks in advance!
yes u can use the batch.
but u need to instruct them to run it as admin, Right click the file -> Run as Administrator
Avatar of Brian

ASKER

Hi sedgwick,

would you be able to upload that .bat file and upload it to me in a .txt file? So I make sure I dont screw it up.
Avatar of Brian

ASKER

Hi sedgwick,

Ok, so I visited the site that you supplied and put the following code below into Notepad and then saved the file as ie9.bat. When I run the .bat file a cmd windows appears for 1 second then disappers but nothing happens after that.


FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-*9.*.mum /c “cmd /c echo Uninstalling package @fname && start /w pkgmgr /up:@fname”
Avatar of Brian

ASKER

Hi sedgwick,

Are you still able to help?
open the command window and run the batch from there, if there's an error u should be able to see it.