Resolution Change while running in command Prompt

Selva 1 Reputation point

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,427 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 45,416 Reputation points

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

    0 comments No comments