Use this Visual Basic script. Enumerates registry DisplayName for Ask Toolbar and silently uninstall.
'find and display uninstallstring in "constant CHECK_MASK". Matches DisplayName in registry using regexp.
'uncomment owsh.run to actually run uninstall
'http://en.wikipedia.org/wiki/Regular_expression
const CHECK_MASK="^Ask" 'checks beginning of DisplayName for Ask
const HKEY_CLASSES_ROOT = &H80000000
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
const HKEY_USERS = &H80000003
const HKEY_CURRENT_CONFIG = &H80000004
const HKEY_DYN_DATA = &H80000005
strComputer = "."
Set RegEx = CreateObject("VBScript.RegExp")
RegEx.IgnoreCase = False ' CHECK_MASK have to be case sensitive
RegEx.Global= True
RegEx.Pattern=CHECK_MASK
set oWsh = createobject("wscript.shell")
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
'32 bit
strKeyPath32 = "software\microsoft\windows\currentversion\uninstall" 'Root level
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath32, arrSubKeys
For Each subkey In arrSubKeys
on error resume next
sDisplayName = oWsh.Regread("HKLM\" & strKeyPath32 & "\" & subkey & "\DisplayName")
if err.number = 0 then
on error goto 0
if regex.test(sDisplayName) = True then
On Error Resume Next
sUninstall = oWsh.Regread("HKLM\" & strKeyPath32 & "\" & subkey & "\UnInstallString")
If Err.Number = 0 Then
strSearchFor = "/I" 'checks if uninstallstring contains /i instead of /x
If InStr(1, sUninstall, strSearchFor) > 0 then
newUninstall = replace(sUninstall,strsearchfor,"/X") 'replace /i with /x
wsh.echo subkey, vbCRLF, sDisplayName, vbCRLF, newUnInstall, vbCRLF, vbCRLF 'comment to run
'owsh.run newUninstall & " /quiet /norestart" 'uncomment to actually run
Else
wsh.echo subkey, vbCRLF, sDisplayName, vbCRLF, sUnInstall, vbCRLF, vbCRLF 'comment to run
'owsh.run sUninstall & " /quiet /norestart" 'uncomment to actually run
End If
Else
End If
On Error GoTo 0
end if
end if
Next
'64 bit
strKeyPath64 = "software\Wow6432Node\microsoft\windows\currentversion\uninstall" 'Root level 64 bit
if oReg.EnumKey (HKEY_LOCAL_MACHINE, strKeyPath64, arrSubKeys) = 0 Then
For Each subkey In arrSubKeys
on error resume next
sDisplayName = oWsh.Regread("HKLM\" & strKeyPath64 & "\" & subkey & "\DisplayName")
if err.number = 0 then
on error goto 0
if regex.test(sDisplayName) = True then
On Error Resume Next
sUninstall = oWsh.Regread("HKLM\" & strKeyPath64 & "\" & subkey & "\UnInstallString")
If Err.Number = 0 Then
strSearchFor = "/I" 'checks if uninstallstring contains /i instead of /x
If InStr(1, sUninstall, strSearchFor) > 0 then
newUninstall = replace(sUninstall,strsearchfor,"/X") 'replace /i with /x
wsh.echo subkey, vbCRLF, sDisplayName, vbCRLF, newUnInstall, vbCRLF, vbCRLF 'uncomment to run
'owsh.run newUninstall & " /quiet /norestart" 'uncomment to actuall run
Else
wsh.echo subkey, vbCRLF, sDisplayName, vbCRLF, sUnInstall, vbCRLF, vbCRLF 'uncomment to run
'owsh.run sUninstall & " /quiet /norestart" 'uncomment to actually run
End If
Else
End If
On Error GoTo 0
end if
end if
Next
Else
End if
on error goto 0