See if on of the functions in this link helps: how-can-i-do-a-screen-capture-in-windows-powershell
Resolution Change while running in command Prompt
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)
How did you run the script in the command prompt? I ran your script in the powershell ISE and command prompt and the screenshots have the same resolution.
Sign in to comment
Sort by: Most helpful