Myself, I am too cautious to actually delete even "unregistered" installer files. However, I thought I would share what I put together (based on this and similar postings) for a co-worker, who was looking to tidy up some machines.
$Registered = Get-ItemPropertyValue -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\* -Name LocalPackage
$Found = Get-ChildItem "$env:WINDIR\Installer\*" -Include *.msp,*.msi -Recurse | Select-Object -ExpandProperty FullName
# Show difference
Compare-Object $Registered $Found
$Unregistered = $InstallersFound | Where-Object {$_ -notin $InstallersRegistered}
# Total Bytes unregistered
$Unregistered | Get-ChildItem | Measure-Object -Sum -Property Length
# Remove unregistered installers
$Unregistered | Remove-Item -WhatIf
2While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – G-Man Says 'Reinstate Monica' – 2015-03-12T09:58:35.517
Thanks for the comment @G-Man, I've added more detail and some personal notes from experience using one of the options. Hope it pleases :) – PostureOfLearning – 2015-03-12T12:20:54.677
Well looks like there are plenty of answers here, I wont add another one. Practically the very safe way: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B290301 - windows installer cleanup untiliy. The other way: delete .. It works, I've tested this. My /installer/ is empty without affecting anything.
– Overmind – 2015-03-12T12:59:05.603The page mentioned by Overmind above does no longer exist. However I've used WiCleanup and it worked great on Windows 7. Thank you very much for the tip. – Yaba – 2016-04-20T10:30:36.207
Use of WiCleanup https://www.screencast.com/t/hO6XW5F7XWIN
– appqui-platform – 2018-09-28T10:03:16.033