I'm currently studying Powershell and working on a script that grabs Display configuration from windows system. I get 2 question:
Question 1. The script is:
"Display Config" >> system1.txt
"----------------------------------------------------------------------------
---------------------------------" >> system1.txt
add-type -assemblyName system.windows.forms
[system.windows.forms.screen]::AllScreens | Format-List Bounds | out-file -append system1.txt
The output is the result of resolution of 2 monitors, just like that:
Bounds : {X=0,Y=0,Width=1920,Height=1080}
Bounds : {X=1920,Y=0,Width=2560,Height=1440}
But I just want to extract values of 'Width' and 'Height', and the make output show like:
Width:1920
Height:1080
Width:2560
Height:1440
Question2: For this script:
Get-WmiObject WmiMonitorconnectionparams -Namespace root\wmi | format-List
VideoOutputTechnology | out-file -append system1.txt
I get results:
VideoOutputTechnology : 10
VideoOutputTechnology : 4
But the value 4 and 10 need to be decoded, ie '10 = Displayport External'
according to an url: https://technet.microsoft.com/en-us/ff546605(v=vs.89)
How could I decode the value according to the URL and make the result only show like 'Displayport External'
in the output txt?
I would greatly appreciate your reply.