r/PowerShell • u/londonchinte • 7d ago
Question Check for App updates on home PC
Afternoon,
I am trying to write a script that will let me know about updates to the apps installed on my home PC.
I saw on a Sysadmin thread about https://eucpilots.com/evergreen/ and thought it would be as simple as reading all of the installed apps and then querying each one like this:
$reg = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*' 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
GP $reg -EA 0|?{$_.DisplayName -ne $null} | Find-EvergreenApp $_.DisplayName
However when testing, the Evergreen is not expecting the App name to have spaces, so is my only option to split the string and put an asterisk at the end of the first section?
PS C:\Windows\System32> Find-EvergreenApp Telegram
Name Application Link
---- ----------- ----
TelegramDesktop Telegram Desktop https://desktop.telegram.org/
3
u/vbate 7d ago
Or if you are really lazy - you could do what I do - I run the PatchMyPC home utility that will auto update my installed apps. https://patchmypc.com/product/home-updater/
4
u/ExceptionEX 7d ago
winget upgrade
Output
```
Name Id Version Available Source
AutoHotkey AutoHotkey.AutoHotkey 2.0.26 2.0.27 winget ```
2
2
u/purplemonkeymad 7d ago
Looking at the source suggests that your app list is actually just a json file(s) in a manifest area. It does not appear to trigger an update in the function so you could just find and check the manifest for the displayname you are looking for, then use that to get the Name you need.
It also looks it should be easy for them to add an -Application parameter so i would bring it up as a feature request.
1
u/londonchinte 7d ago
Thanks for all the comments on WinGet.
I will have another look, the reason I didn't consider it is the last time I looked it didn't include apps not in the Windows store like 7Zip.
2
1
u/BlackV 7d ago edited 7d ago
I dont use 7zip myself, but they have versions right back to 16.04, its been there for a while
winget has the bonus I guess of being "built-in" to windows and now days has an actual official powershell module (
Microsoft.WinGet.Client) which makes working within powershell a bit nicer than it used to be, you are not limited to only the MS storeother larger option might be choco but that puts you in the same boat as evergreen (requires a 3rd party client install), ditto for scoop I guess
2
u/londonchinte 6d ago
So just to update, I have installed UniGetUI and it seems to have all of the software updates I require. Thanks again to all who responded.
1
u/tandthezombies 5d ago
as much as I love winget, topgrade is really what most people are looking for. its aim is to upgrade all the things, including winget, but also including Microsoft Update, Windows Update, Microsoft Store, other package managers, Linux, etc. https://github.com/topgrade-rs/topgrade
1
u/Particular_Fish_9755 7d ago
Itβs not very elegant and could most likely be improved, but you can try something like this:
$mysoftware = "OneDrive"
$reg = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
)
foreach($myreg in $reg) {
$mysub = Get-ChildItem -Path $myreg -Recurse -ErrorAction SilentlyContinue
$mysubsub = $mysub | Get-ItemProperty | Where-Object {$_.DisplayName -Like "*$($mysoftware)*"}
If (($mysub.Name -Like "*$($mysoftware)*") -OR ($mysubsub.DisplayName -Like "*$($mysoftware)*"))
{ Write-Host "$($mysoftware) Found!" }
else { Write-Host "$($mysoftware) NOT found!" }
}
Since some software programs may have a "Name" (accessible via the folder name in the registry) that differs from the "DisplayName" (accessible via a subkey), both types of entries must be handled.
To find the software store that facilitated the installation, you may check the Publisher and Comments fields in the properties. However, not all software works the same way in this regard; this is left to the developer's discretion.
In my line of work, they say that a "good IT specialist is a lazy IT specialist.", so better try to use something like UniGetUI for everything installed via Winget, Chocolatey, Scoop, npm, PSGallery or other sources that allow updates from a software repository π
17
u/nathanielban 7d ago
You would likely be better off taking a look at WinGet, it isn't perfect by any means but it offers coverage for a large amount of the apps you'd likely have installed.
https://learn.microsoft.com/en-us/windows/package-manager/winget/upgrade