|
Rank: Advanced Member Joined: 6/20/2011 Posts: 118 Location: NC
|
I have created a small utility for removing unattended installs without leaving anything open on the client side ... it works for me ... just place in toolbox and execute when connected to an unattended client . after a few secs your connection will break and the client will be uninstalled... i created it using Autoit .. Attached is the EXE to place in your toolbox..... New Version Auto Searches Registry Should be Fixed : Download the EXE HERE remove-unattended.exeCode:Func _RegSearch($sStartKey, $sSearchVal, $iType = 0x07, $fArray = False) Local $v, $sVal, $k, $sKey, $sFound = "", $sFoundSub = "", $avFound[1] = [0]
; Trim trailing backslash, if present If StringRight($sStartKey, 1) = "\" Then $sStartKey = StringTrimRight($sStartKey, 1)
; Generate type flags If Not BitAND($iType, 0x07) Then Return SetError(1, 0, 0); No returns selected Local $fKeys = BitAND($iType, 0x1), $fValue = BitAND($iType, 0x2), $fData = BitAND($iType, 0x4), $fRegExp = BitAND($iType, 0x8)
; Check for wildcard If (Not $fRegExp) And ($sSearchVal == "*") Then ; Use RegExp pattern "." to match anything $iType += 0x8 $fRegExp = 0x8 $sSearchVal = "." EndIf
; This checks values and data in the current key If ($fValue Or $fData) Then $v = 1 While 1 $sVal = RegEnumVal($sStartKey, $v) If @error = 0 Then ; Valid value - test its name If $fValue Then If $fRegExp Then If StringRegExp($sVal, $sSearchVal, 0) Then $sFound &= $sStartKey & "\" & $sVal & @LF Else If StringInStr($sVal, $sSearchVal) Then $sFound &= $sStartKey & "\" & $sVal & @LF EndIf EndIf
; test its data If $fData Then $readval = RegRead($sStartKey, $sVal) If $fRegExp Then If StringRegExp($readval, $sSearchVal, 0) Then $sFound &= $sStartKey & "\" & $sVal & " = " & $readval & @LF Else If StringInStr($readval, $sSearchVal) Then $sFound &= $sStartKey & "\" & $sVal & " = " & $readval & @LF EndIf EndIf $v += 1 Else ; No more values here ExitLoop EndIf WEnd EndIf
; This loop checks subkeys $k = 1 While 1 $sKey = RegEnumKey($sStartKey, $k) If @error = 0 Then ; Valid key - test it's name If $fKeys Then If $fRegExp Then If StringRegExp($sKey, $sSearchVal, 0) Then $sFound &= $sStartKey & "\" & $sKey & "\" & @LF Else If StringInStr($sKey, $sSearchVal) Then $sFound &= $sStartKey & "\" & $sKey & "\" & @LF EndIf EndIf
; Now search it $sFoundSub = _RegSearch($sStartKey & "\" & $sKey, $sSearchVal, $iType, False) ; use string mode to test sub keys If $sFoundSub <> "" Then $sFound &= $sFoundSub & @LF Else ; No more keys here ExitLoop EndIf $k += 1 WEnd
; Return results If StringRight($sFound, 1) = @LF Then $sFound = StringTrimRight($sFound, 1) If $fArray Then If StringStripWS($sFound, 8) <> "" Then $avFound = StringSplit($sFound, @LF) Return $avFound Else Return $sFound EndIf EndFunc ;==>_RegSearch
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$SearchKey = "HKLM\SOFTWARE\Classes\Installer\Products"
$SearchString = "ScreenConnect Guest Service" ; find $Results = _RegSearch($SearchKey, $SearchString, 4, 1)
$location = StringSplit ( $Results[1], "\,\" )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$start = MsgBox(4, 'Uninstall ?', 'Remove Remote Client Software?')
If $start = 6 Then
$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\" & $location[6], "ProductIcon") If @error = 1 Then MsgBox(0, 'Not Installed', 'ScreenConnect Client Not Installed') Exit EndIf
$ID = StringSplit ( $var, "{,}" ) ShellExecute("MsiExec.exe", "/qn /x {" & $ID[2] & "} REBOOT=REALLYSUPRESS")
SplashTextOn("Please Wait", "Starting Removal Process......", 450, 70, -1, -1, 4, "", 24) Sleep(10000) SplashOff()
Else Exit EndIf
hope you enjoy ...feel free to improve
|
|
1 user thanked teksigns for this useful post.
|
|