Reputation: 111
I've the following result from a PowerShell array:
Level
-----
0
How can I convert it to an Int to retrieve only the value which is the number under the level?
Upvotes: 0
Views: 5523
Reputation: 1027
Like Ansgar said, use Select-Object with the -ExpandProperty parameter. I like that best as if .value isnt there for some reason it wont error out.
If it MUST be a INT then you can cast it like this:
[int]($MyArray | select -ExpandProperty Level)
Upvotes: 1