Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Define the value to search for in DisplayName
- $searchValue = "vmware" # Replace with the desired value
- # Define the registry path
- $registryPath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
- # Collect results
- $results = @()
- # Recursively search the registry path
- Get-ChildItem -Path $registryPath -Recurse | ForEach-Object {
- try {
- # Check if DisplayName exists and matches the search value
- $displayName = (Get-ItemProperty -Path $_.PSPath -ErrorAction Stop).DisplayName
- if ($displayName -like "*$searchValue*") {
- # Retrieve the UninstallString
- $uninstallString = (Get-ItemProperty -Path $_.PSPath -ErrorAction Stop).UninstallString
- # Add to results
- $results += [PSCustomObject]@{
- DisplayName = $displayName
- UninstallString = $uninstallString
- }
- }
- } catch {
- # Ignore errors (e.g., keys without DisplayName or UninstallString)
- }
- }
- # Display results as a table
- if ($results.Count -gt 0) {
- $results | Format-Table -AutoSize
- } else {
- Write-Host "No matching applications found." -ForegroundColor Yellow
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement