CodeUnderflow CodeUnderflow - 2 months ago 10x
PowerShell Question

Find out the current version and update of an installed application

I have some requirement where I have to find out the current version and update details of an installed application (highlighted):

enter image description here

And I have this PowerShell snippet for modification:


$ServiceInfo = Get-WmiObject win32_service -ComputerName $server -ExpandProperty Version | Where-Object {$_.Name -eq "VSTTAgent"}
if($ServiceInfo.State -eq "Running")
$userAccount = $ServiceInfo.DisplayName.ToString()
Write-Host ("VSTTAgent service is Running on $server and $userAccount ")


To get the product version, you can use the Get-Item cmdlet using the PathName property of your $ServiceInfo object:

$ServiceInfo.PathName.Trim('"') | Get-Item | select -expand VersionInfo | select ProductVersion