0

I'm trying to extract the GUIDS from this list.

Get-WMIObject WIN32_Product | ? {$_.IdentifyingNumber -like "*26A24AE4-039D-4CA4-87B4-2F8321*FF*"} | Format-List IdentifyingNumber

is it possible to convert each item into a string and possibly assign them to variables?

Here's what I was trying, but it's not working. but maybe this will show the logic i am trying:

$A = Get-WMIObject WIN32_Product | ? {$_.IdentifyingNumber -like "*26A24AE4-039D-4CA4-87B4-2F8321*FF*"} | Format-List IdentifyingNumber

$GUIDList = ForEach-Object{$A.ToString()}

$GUIDList

2 Answers 2

2

Format-list is, as the name suggests, for display formatting purposes.

Based on your usage, I suppose you can use Select-Object instead:

| Select-Object IdentifyingNumber

After that you will have an array of objects with property IdentifyingNumbers.

If you just want array /list of strings ( assuming the property is string ) you could do:

| Select-Object -expand IdentifyingNumber
Sign up to request clarification or add additional context in comments.

1 Comment

Wow... I didn't realize it was that easy! Thank you so much for the response!
0

Here's another useful option that uses a WQL filter and uses the Foreach-Object cmdlet to extract the identifiers:

Get-WmiObject Win32_Product -Filter "IdentifyingNumber LIKE "%26A24AE4-039D-4CA4-87B4-2F8321%FF%"} | 
Foreach-Object {$_.IdentifyingNumber}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.