Search code examples
powershellwmic

Get IdentifyingNumber of Software in Powershell


I need the IdentifyingNumber of a certain Software as in ONLY the IdentifyingNumber.

Here is my code which finds the ID of a certain Software.

$k_agent_identifyingnumber = Get-WmiObject Win32_Product | Where-Object {$_.Name -like "*XY* *XY* *XY*"} | Select IdentifyingNumber

Write-Host $k_agent_identifyingnumber

Which gives me the result

@{IdentifyingNumber={XXXF24-88AB-45E1-A6E6-40C8278XXXX}}

Is it possible to remove the whole "@{IdentifyingNumber=} ???

Thanks for your help!


Solution

  • You need to expand the property, to only return the property value.

    Select-Object -ExpandProperty IdentifyingNumber