Resolution Change while running in command Prompt

Selva 1 Reputation point
2021-02-25T16:34:32.47+00:00

When the below script is executed in PowerShell ISE. The resolution of the print screen image is 1920 x 1080. When the same script is executed in command prompt. The resolution of the print screen image is 1536 x 864. Can someone explain why the resolution changes when the script is executed in command prompt. How to set it back to 1920 x 1080. Add-Type -AssemblyName System.Windows.Forms Add-type -AssemblyName System.Drawing $MyScreen = [System.Windows.Forms.SystemInformation]::VirtualScreen $ScreenWidth = $MyScreen.Width $ScreenHeight = $MyScreen.Height $ScreenLeft = $MyScreen.Left $ScreenTop = $MyScreen.Top $bitmap = New-Object System.Drawing.Bitmap $ScreenWidth, $ScreenHeight $graphic = [System.Drawing.Graphics]::FromImage($bitmap) $graphic.CopyFromScreen($ScreenLeft, $ScreenTop, 0, 0, $bitmap.Size) $File = "E:\PS\Screen.bmp" $bitmap.Save($File)

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 45,091 Reputation points
    2021-02-25T19:37:07.99+00:00

    See if on of the functions in this link helps: how-can-i-do-a-screen-capture-in-windows-powershell

    0 comments No comments