0
votes

I am trying to get specified rows from a CimInstance object and I thought to turn them to string, but did not find the answer how to do that.

PS C:\Users\laptop> Get-CimInstance -Namespace root/WMI -ClassName WmiMonitorBrightness


Active            : True
CurrentBrightness : 50
InstanceName      : DISPLAY\LEN40A1\4&342c5d56&0&UID67568640_0
Level             : {0, 1, 2, 3...}
Levels            : 101
PSComputerName    :

I need to get two rows, "CurrentBrightness : 50" and "Levels : 101", from the results on screen, but the return is a [Microsoft.Management.Infrastructure.CimInstance]. I had tried to make them to be strings though.

1

1 Answers

1
votes

The "rows" you see are actually the properties of an object displayed in list form. You can select properties of any given object via the Select-Object cmdlet:

Get-CimInstance ... | Select-Object CurrentBrightness, Levels