/build/static/layout/Breadcrumb_cap_w.png

Get-WmiObject -class Win32_InstalledStoreProgram

Can anyone tell me how to return "Version" in a variable with the following command: Get-WmiObject -class Win32_InstalledStoreProgram | Where-Object name -eq Microsoft.VP9VideoExtensions

0 Comments   [ + ] Show comments

Answers (1)

Posted by: Kiyolaka 2 years ago
Third Degree Green Belt
0

Is the package you're trying to query listed when you run get-appx package? I would try to avoid get-wmiobject or wmic.exe whenever possible as Microsoft has discussed plans to remove them in the near future
As far as getting a specific property as a return from a command, you'd want to look at the property names (likely name and version) and then add | select-object - property name, version ... Etc Above example would pull both the name and version property.Select-object -property version.. would display only the version. And so on
Also, usually not all properties are automatically displayed when you run a command you can often pipe the command to | fl .. to see all properties associated with an object.
I.e. get-appxpackage | fl ,Would show you all possible properties and their values. From that return you can find which properties you want to cherry pick using select-object -property 


You can also specify a command return as a variable.

(The code for this might not be fully accurate as on mobile)

But something along the lines of the following should work

$productversion=(Get-WmiObject -class Win32_InstalledStoreProgram | Where-Object name -eq Microsoft.VP9VideoExtension)

And you could then call $productversion.version


$productversion=(Get-WmiObject -class Win32_InstalledStoreProgram | Where-Object name -eq Microsoft.VP9VideoExtension).version 

To get the value directly as a variable





 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ