How do I find my monitor’s name in PowerShell?

0
2
Asked By TechWizard42 On

I'm trying to identify the name of my monitor using PowerShell. I've noticed that when I go to System > Display > Advanced Display settings, I can see something like 'Display X: Connected to YOUR_MONITOR_NAME_HERE'. However, I really want to retrieve this monitor name directly through PowerShell without relying on its friendly name, as it doesn't seem to work for my monitor. Any suggestions on how I can do this?

4 Answers

Answered By PowerScriptPro On

You could try running this command to export all monitor properties to a text file:

```powershell
Get-CimInstance -ClassName CIM_Display | Format-Custom -Property * | Out-File c:pathtofile.txt
```

Then check that file for any properties that match what you see in the GUI. It might help you locate the correct information you're after.

FileExplorer -

Unfortunately, I didn't find anything useful in the file.

DisplayDynamo -

Isn't display information usually separated from monitor data?

Answered By GizmoGuru99 On

You can try using the following PowerShell function that queries the WMI to get monitor information. This will return details like Manufacturer and Serial Number as well. Here's a snippet you can use:

```powershell
Function Get-MonitorModel {
param($Array)
return -join [char[]]$Array
}

$Query = Get-WmiObject -Query "Select * FROM WMIMonitorID" -Namespace rootwmi
$Results = $Query | ForEach-Object {
New-Object PSObject -Property @{
Manufacturer = Get-MonitorModel($_.ManufacturerName)
SerialNumber = Get-MonitorModel($_.SerialNumberID)
}
}
$Results
```

This should work for multiple monitors and provide you with the crucial details you need!

DisplayDynamo -

Awesome, this script worked perfectly for my setup and showed me details on all three monitors!

Answered By CodeCrafter88 On

If you’re looking for the monitor name specifically, you should look into using CIM/WMI queries. I remember seeing a post here recently that might help you get what you need. Just note that sometimes the friendly names might not be available for certain monitors.

MonitorHunter -

Yeah, WMI can show the friendly name, but it doesn’t show up for mine either. It's kind of frustrating.

Answered By TechTinkerer On

It might be worth looking into related classes to see if the monitor name is stored under different properties. You can use wildcards in your queries like this:

```powershell
Get-CimClass -PropertyName *monitor*
Get-CimClass -PropertyName *display*
```

This could give you a broader view of any related class that contains the details you need. One of the classes you might want to check is Win32_DesktopMonitor. Just a side note, your original code has quite a few steps baked in that could be simplified!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.