简体   繁体   中英

PowerShell command to get installed application/software version

I need to read product version from control panel for specific application. I'm using this command till now.

Get-WmiObject Win32_Product -Filter "Name like 'ISASmaartHub'" | Select-Object -ExpandProperty

after upgrading my system to Windows 11 it is throwing this exception -

Select-Object : Missing an argument for parameter 'ExpandProperty'. Specify a parameter of type 'System.String' and try again.
At line:1 char:82
+ ...  -Filter "Name like 'ISASmaartHub'" | Select-Object -ExpandProperty
+                                                           ~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Select-Object], ParameterBindingException
    + FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.SelectObjectCommand

Can anyone please suggest which command I should use to read the version of an application on Windows 11 system.

Thanks in advance!

  1. Prefer using Get-CimInstance over Get-WmiObject for new applications, as WMI is being deprecated.
  2. For WMI\CIM, operator LIKE uses WQL language and should have a % sign as a mark for Any symbols . WQL Like Syntax
  3. Select -ExpandProperty smth means from this big object select only value of smth property. This means, property name MUST present.

Working Example for product named 1C :

Get-CimInstance -Filter 'NAME LIKE "%1C%"' -ClassName 'Win32_Product' | 
    Select -ExpandProperty 'Version'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM