Get Screen Resolution of remote computers

The below script will display the screen resolution of local machine. To display the screen resolution of a remote machine , supply the computer name and its credentials as parameters.

Script

<#
.SYNOPSIS
This script can be used to display 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
}
}

 

Output
Resolution
Resolution2

Leave a Reply