14 posts in this topic
I'm working on a WMIC uninstaller. A quite simple one with a button to display product names in a editable list (for copy/paste purposes) but the main problem is that in order to achieve this, in my corporation, normal users cannot uninstall softs.
What I found/adapt so far:
#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("wmic uninstaller", 300, 152, 337, 380) $Label1 = GUICtrlCreateLabel("Computername", 0, 8, 75, 17) $Input1 = GUICtrlCreateInput(@ComputerName, 0, 32, 125, 21) $Label2 = GUICtrlCreateLabel("wmic command", 150, 8, 77, 17) $Combo1 = GUICtrlCreateCombo("Model_Computer", 150, 32, 125, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Current_user|Installed_Apps|Serial_Number|Bios_Version") $Button1 = GUICtrlCreateButton("List Apps", 150, 72, 91, 49) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $button1 $wmi = GUICtrlRead($combo1) $pc = GUICtrlRead($input1) call($wmi,$pc) EndSwitch WEnd Func Model_Computer($pc) RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' product get name > %temp%\apps.txt' ,"", @SW_HIDE) $file=(@TempDir & "/apps.txt") $fileread= FileRead($file) MsgBox(0, $pc , $fileread) FileDelete(@TempDir & "/apps.txt") EndFunc Here's the textual version I gave to my techs:
Create cmd shortcut on Desktop, run it as a different user (using their own admin accounts). Once opened, type wmic Once wmic loaded, type product get name Wait for the list of installed soft to display Type product where name="Exact App name" call uninstall Type "Y" to confirm Wait for task execution Don't care about exit code App is uninstalled (verified by getting the list again)! In fact, I'd like to automatize this process.
Any ideas over here?