How to get the screen resolution in Windows 10 using PowerShell

Get Screen Resolution of remote computers

Administrators sometimes have to document certain properties of the computers in their network. The most common one is the screen resolution. Doing so on a collection of remote computers only adds to the complication. However, with the help of the below PowerShell script, one can get the screen resolution of a remote machine. 

How to get the screen resolution in Windows 10 using PowerShell

The Get-DisplayResolution WMI cmdlet shows the display resolution for Windows 10 computers. Use the following PowerShell script to get the current screen resolution. Provide the computer name as the parameter and run the script. The resolution of the screen will be displayed. 

Script
<#
.SYNOPSIS
This script can be used to display the Screen Resolution of a Remote machine
.DESCRIPTION
This script can be used to display Screen Resolution information of a Remote machine.
.EXAMPLE
C:\PS> C:\Script\Resolution.ps1
Displays Screen Resolution of a Local machine.
.EXAMPLE
C:\PS> C:\Script\Resolution.ps1 admp-dc1 admp\administrator
Displays Screen Resolution information of a Remote machine.
#>

param( [string]$strComputer=”.”,[string]$Cred)
if($Cred -eq “”)
{
#To display screen resolution of a local machine.

$colItems = get-wmiobject -class “Win32_DisplayConfiguration” -namespace “root\CIMV2” -computername $strComputer
}
else
{
#To display screen resolution of a Remote machine.

$colItems = get-wmiobject -class “Win32_DisplayConfiguration” -namespace “root\CIMV2” -computername $strComputer -Credential $cred
}
if($colItems)
{
foreach ($objItem in $colItems) {
write-host “Device Name :” $objItem.DeviceName
write-host “Pels Width :” $objItem.PelsWidth
write-host “Pels Height :” $objItem.PelsHeight
write-host “Bits Per Pel :” $objItem.BitsPerPel
write-host “Display Frequency :” $objItem.DisplayFrequency
}
}























    • Related Articles

    • Set Screen Saver Timeout

      Windows computers are usually configured to lock the screen after some time of inactivity. This is especially inconvenient if the remote desktop session keeps disconnecting each time after a few minutes of being idle. The Windows registry holds the ...
    • How to Get and Set properties of the Active Directory user using PowerShell

      In this article, we will discuss how to get and set properties of an Active Directory user using PowerShell. Here’s how to get User Properties To get user properties from Active Directory, Get-ADUser cmdlet can be used. Here is an example of how to ...
    • How to get memberships of the Active Directory user using PowerShell

      One of the essential parts of Active Directory administration is to manage user memberships in Active Directory. There may be times when the membership of a specific user need to be identified. In this article, we will explain how to use PowerShell ...
    • Managing Microsoft updates on Windows

      System update management for Windows machines in an Active Directory (AD) environment is a critical task of an administrator. While managing the updates for a handful of machines is a fairly simple task, managing a many Windows machines and keeping ...
    • WMI privileges for a non-administrator user using Powershell

      Administrators often find themselves working against time. In an environment where the time is of essence, certain day-to-day tasks like password resets, enabling remote access, etc., can be rationed off of technicians. However, technicians are ...