Thanks a lot for those who can couple of suggestions. I recently did something similar for a customer using WMI to query the machine (note, some crapware will not be seen through WMI, so I have on occasion had to do a mixture of WMI calls and searching through the registry):
#Wmic uninstall name like update#
txt file and make the script read it line after line?, Other ideas? ^^)Ĥ/ How can I exclude some programs in the soft list? I mean, I don't want the tech to see all Security Update blablabla crap and other things in the list (as the Anti Virus.) bat file for each selection? / Make the script running "RunAsWait($sT0_AdminUserName, "DOMAIN" ,$sT0_AdminUserPassword, 2, "WMIC.exe product where ""name like '" & $sAppToUninstall& "'"" call uninstall each selection? / write the selection in a.
#Wmic uninstall name like how to#
Expand collapse popup #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #Include #include #include #include #include #include #include #include #include #include #Include #include #include #include #include #include #include #NoTrayIcon Opt ( "TrayAutoPause", 0 ) Opt ( 'GUIOnEventMode', 1 ) Opt ( 'GUICloseOnEsc', 1 ) FileDelete ( "Uninstall.txt" ) Global $i Global $sSft Global $sGui = GUICreate ( 'Select Programs You want to Uninstall:', 471, 650, - 1, - 1 ) Global $sLvw = GUICtrlCreateListView ( 'Program Name', 2, 2, 467, 580, - 1, $LVS_EX_CHECKBOXES ) _ComputerGetSoftware ( $sSft ) For $i = 1 To ubound ( $sSft ) - 1 GUICtrlCreateListViewItem ( $sSft, $sLvw ) Next GUICtrlSendMsg ( $sLvw, 0x101E, 0, 450 ) Local $exp = GUICtrlCreateButton ( ' Uninstall ', 195, 590, 100, 55 ) Local $clear_sel = GUICtrlCreateButton ( ' Clear Selection ', 0, 600 ) Local $g_exit = GUICtrlCreateButton ( ' Exit ', 430, 600 ) GUICtrlSetOnEvent ( $exp, '_Uninstall' ) GUICtrlSetOnEvent ( $g_exit, '_AllExit' ) GUISetOnEvent ( - 3, '_AllExit' ) GUISetState (, $sGui ) While 1 Sleep ( 1000 ) WEnd Func _ComputerGetSoftware ( ByRef $aSoftwareInfo ) Local Const $UnInstKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" Local $i = 1 Dim $aSoftwareInfo For $j = 1 To 500 $AppKey = RegEnumKey ( $UnInstKey, $j ) If 0 Then Exitloop If RegRead ( $UnInstKey & "\" & $AppKey, "DisplayName" ) = '' Then ContinueLoop ReDim $aSoftwareInfo $aSoftwareInfo = StringStripWS ( RegRead ( $UnInstKey & "\" & $AppKey, "DisplayName" ), 1 ) $i = $i + 1 Next $aSoftwareInfo = UBound ( $aSoftwareInfo, 1 ) - 1 Return _ArraySort ( $aSoftwareInfo ) EndFunc Func _ClearSel ( ) EndFunc Func _AllExit ( ) GUIDelete ( $sGui ) FileDelete ( "Uninstall.txt" ) Exit EndFunc Func _Uninstall ( ) Local Const $iCount = _GUICtrlListView_GetItemCount ( $sLvw ) For $i = 1 To $iCount If _GUICtrlListView_GetItemChecked ( $sLvw, $i - 1 ) Then $sAppToUninstall = _GUICtrlListView_GetItemText ( $sLvw, $i - 1 ) Endif Next Global $g_Confirm = Msgbox ( 52, "WARNING", "Your're about to uninstall " & $sAppToUninstall & & & "Continue?" ) If $g_Confirm = $IDYES Then GuiSetState $g_UninstallGUI) - Local Const $iCount = _GUICtrlListView_GetItemCount($sLvw) FileOpen("Uninstall.txt", 2) For $i = 1 To $iCount If _GUICtrlListView_GetItemChecked($sLvw, $i - 1) Then FileWrite("Uninstall.txt", _GUICtrlListView_GetItemText($sLvw, $i - 1) & EndIf Next FileClose ("Uninstall.txt") ShellExecute("Uninstall.bat") Exit EndFuncġ/ If I click 2 items, only the last one is taken into account when I click the "uninstall" button (the msgbox is for testing outputs ATM)Ģ/ I can't figure out how to make the "Clear Selection" button to work (this may be a dumb question)ģ/ I'd like to queue un-installations according to what the tech checked, in your opinion, what is best? (Make the script generating and executing a sort of.