How to get a string instead of an array in PowerShell?

Question:

I’m trying to do the following:

Sample result:

How do I get only the following?

Answer:

Here is the answer to get just the name from your example. Surround the $i with $( ) and reference the .Name property. The $() will cause it to evaluate the expression.

Source:

How to get a string instead of an array in PowerShell? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply