Tuesday, February 13, 2024

#105: Get list of all the monitors installed in your system using Powershell

Welcome back!

Today, I want to provide a small snippet that could list all the monitors installed in you system.

# Get all monitors
$monitors = Get-WmiObject -Namespace root\cimv2 -Class Win32_DesktopMonitor


# Output information about each monitor
foreach ($monitor in $monitors) {
   
    Write-Output "Monitor Name: $($monitor.Name)"
    Write-Output "Monitor Manufacturer: $($monitor.Manufacturer)"
    Write-Output "Monitor Screen Height: $($monitor.ScreenHeight)"
    Write-Output "Monitor Screen Width: $($monitor.ScreenWidth)"
    Write-Output "-----------------------------"
}


This was quite quick and easy.

Thanks!

No comments:

Post a Comment

#112: How to handle xml document in Powershell?

 In PowerShell, you can handle XML data using various cmdlets and methods provided by the .NET Framework. Here's a basic guide on how to...