How to Identify Uninstaller Information From Registry Keys

System 7 Replies

If you want a fast way to get information about the uninstallers that are listed in the registry, then check out this simple script to parse out some information for you. 

This little baby asks you for a search term, then grabs the pertinent software uninstall information out of the HKey Local Machine registry hive.

It’s simple and effective,  and I put it together in just a couple of minutes.  It could stand to have some polish on it, but it does the job and it does it like now!

Would you improve it?  How?  Comments are open.

Drop this code into your ISE or a .ps1 file and run it.

$searchterm = read-host “Enter search term for uninstallers”
$uninstallers = get-childitem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
$founditems = $uninstallers | ? {(Get-ItemProperty -path (“HKLM:\”+$_.name) -name Displayname -erroraction silentlycontinue) -match $searchterm}
write-host “Searched registry for uninstall information on $searchterm”
write-host “——————————————”
if ($founditems -eq $null) {“None found”} else {
write-host “Found “($founditems | measure-object).count” item(s):`n”
$founditems | % {
    Write-host “Displayname: “$_.getvalue(“Displayname”)
    Write-host “Displayversion: “$_.getvalue(“Displayversion”)
    Write-host “InstallDate: “$_.getvalue(“InstallDate”)
    Write-host “InstallSource: “$_.getvalue(“InstallSource”)
    Write-host “UninstallString: “$_.getvalue(“UninstallString”)
    Write-host “`n”
}
}

Usage is simple:  Enter a search term when prompted to get the software display name, version, when installed, the installation source, and the uninstall string.

7 thoughts on “How to Identify Uninstaller Information From Registry Keys

  1. Pingback: Tweets that mention How to Identify Uninstaller Information From Registry Keys | I Love Powershell -- Topsy.com

  2. chris

    One suggestion, if ran on a x64 machine this code will not give the expected results, as the x86 application uninstaller keys are located under the Wow6432Node\ section of the software keys.

    I have been working on modifying the code to do a arch. check @ run time, and change the location of the registery being read based on if its x86 or x64.

    This of course assumes you only want to see x86 applications.
    A further check of x64 applications would be simple to add though.

    Reply
  3. ILovePowershell Post author

    Good call Chris

    maybe something like:

    if (test-path HKLM:\Software\Wow6432Node) {
    $pathRoot= “HKLM:\Software\Wow6432Node” }
    else {$pathRoot = “HKLM:\Software” }

    $uninstallers = get-childitem “$pathRoot\Microsoft\Windows\CurrentVersion\Uninstall”

    A cursory view of both of the uninstall lists on my 64bit system had each of the software entries in the “Software” location duplicated in the “Wow6432Node\Software” location, so I think it would work fine to just get the list of installers from there if that key is present.

    The “test-path” seems like a good choice for the “architecture test”. It looks logical and “in context”, we’re already in the registry poking around, so might as well check there for 64-bit.

    Another way to get it is checking with WMI:

    gwmi win32_operatingsystem | select osArchitecture

    Thanks for reading, and for the comment!

    Reply
  4. Harriet Wimsey

    This is a very handy script, thanks! Can this script be run remotely? I work in a lab broken up into 5 seperate enviornments and I like to be able to run this script to verify all the applications in each environment.

    Reply
  5. bourne

    Hi,

    This is a very cool script!
    I have been toying with it (I hope that is okay) to get me just the uninstall string value.

    I was curious about the section:
    $founditems | % { …. }

    Does this line act like a loop of some sort?

    I was surprised to see it print out multiple lines in the fashion that it did.

    This is probably a dumb question, but it is the first time I have seen this done.

    Another way to check for architecture is to use the $env:ProgramFiles(x86) system variable.

    Cheers

    Reply
    1. Flash Denning

      % is an alias for “foreach-object”

      Thanks for the comment, I’m glad it gave you a starting point. After 3 years, it looks like this post could use an update – the coding is rather messy!

      Reply
  6. bourne

    Hi,

    Thanks so much for the speedy response. I apologize I was not able to respond earlier!

    Thank you for explaining about the %
    This is very cool. Sort of like a short form of a traditional for loop in both bash and powershell.

    I am still learning Powershell and by no means an expert, but to me the code looks great and works as intended which is always nice!
    But I know that as more knowledge is gained in a language it is always nice to go back and look at old coding projects and see if they can be improved.

    Thanks again for the great post. Definitely learned something!

    Cheers

    Reply

Whats Your Take?