# Displaying Monitor Model and Resolution

**URL:** <https://forums.powershell.org/t/displaying-monitor-model-and-resolution/9577>\
**Category:** PowerShell Help\
**Created:** [October 24, 2017, 8:00pm UTC](https://forums.powershell.org/t/displaying-monitor-model-and-resolution/9577 "2017-10-24T20:00:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott-windmiller](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@scott-windmiller](https://forums.powershell.org/u/scott-windmiller)\
**Post date:** [October 24, 2017, 8:00pm UTC](https://forums.powershell.org/t/displaying-monitor-model-and-resolution/9577/1 "2017-10-24T20:00:41Z")

</div>

I am trying to come up with a script to give me the monitor(s) model and resolution. I found this script that gives the model and serial and works great.

```
$ComputerName = 'PC1'
Get-WmiObject -Namespace root\wmi -ClassName wmimonitorid -ComputerName $ComputerName | foreach {
	New-Object -TypeName psobject -Property @{
        Manufacturer = ($_.ManufacturerName -notmatch '^0$' | foreach {[char]$_}) -join ""
        Name = ($_.UserFriendlyName -notmatch '^0$' | foreach {[char]$_}) -join ""
        Serial = ($_.SerialNumberID -notmatch '^0$' | foreach {[char]$_}) -join ""
    }
}
```

I want to have the resolution in there as well but do not believe I can get the resolution from wmimonitorid. I know there are other classnames that have the resolution(s) but I am not sure how to incorporate it into the code above, especially if there are multiple monitors.

Thanks,  
Scott

---

<div class="post-metadata">

**Author:** ![dorian](https://avatars.discourse-cdn.com/v4/letter/d/35a633/32.png) [@dorian](https://forums.powershell.org/u/dorian)\
**Post date:** [October 25, 2017, 1:03am UTC](https://forums.powershell.org/t/displaying-monitor-model-and-resolution/9577/2 "2017-10-25T01:03:42Z")

</div>

Hello,

You can try with this:

```
Add-Type -AssemblyName System.Windows.Forms

$monitor=Get-WmiObject -Namespace root\wmi -ClassName wmimonitorid -ComputerName localhost 
$resolution=[System.Windows.Forms.Screen]::AllScreens

for ($i=0; $i -lt $monitor.Count; $i++) {
	New-Object -TypeName psobject -Property @{
        Manufacturer = ($monitor[$i].ManufacturerName -notmatch '^0$' | foreach {[char]$_}) -join ""
        Name = ($monitor[$i].UserFriendlyName -notmatch '^0$' | foreach {[char]$_}) -join ""
        Serial = ($monitor[$i].SerialNumberID -notmatch '^0$' | foreach {[char]$_}) -join ""
        Resolution = $resolution[$i].WorkingArea
    }
}
```

Hope this helps,  
BR!

---

<div class="post-metadata">

**Author:** ![richard-siddaway](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@richard-siddaway](https://forums.powershell.org/u/richard-siddaway)\
**Post date:** [October 25, 2017, 5:40am UTC](https://forums.powershell.org/t/displaying-monitor-model-and-resolution/9577/3 "2017-10-25T05:40:32Z")

</div>

Closest I could get is this

```
Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorId |
foreach {
   
  $filter = ("InstanceName = '$($psitem.InstanceName)'").Replace("`\", "`\`\")
    
  $maxres = Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorListedSupportedSourceModes -Filter $filter |
  Select-Object -ExpandProperty MonitorSourceModes | 
  Sort-Object -Property {$_.HorizontalActivePixels * $_.VerticalActivePixels} -Descending |
  Select-Object -First 1
  
  if ($psitem.UserFriendlyNameLength -gt 0) {
    $name = ($psitem.UserFriendlyName -notmatch '^0$' | foreach {[char]$_}) -join ""
  }
  else {
    $name = 'Unknown'
  }

  $props = [ordered]@{
     Manufacturer = ($psitem.ManufacturerName -notmatch '^0$' | foreach {[char]$_}) -join ""
     Name = $name
     Serial = ($_.SerialNumberID -notmatch '^0$' | foreach {[char]$_}) -join ""
     MaximumResolution = "$($maxres.HorizontalActivePixels) x $($maxres.VerticalActivePixels)"
  }
  
  New-Object -TypeName PSObject -Property $props  

}
```

Results look like this

```
Manufacturer Name Serial MaximumResolution
------------ ---- ------ -----------------
GSM 22EA63 304NDJX51788 1920 x 1080      
LEN Unknown 0 1600 x 900
```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:37pm UTC](https://forums.powershell.org/t/displaying-monitor-model-and-resolution/9577/4 "2024-05-16T20:37:20Z")

</div>

Closed on May 16, 2024, 8:37pm UTC


