Skip to content

Instantly share code, notes, and snippets.

@kvprasoon
Created March 20, 2018 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvprasoon/dac5944cd87f72e6e35e85a8303f0f98 to your computer and use it in GitHub Desktop.
Save kvprasoon/dac5944cd87f72e6e35e85a8303f0f98 to your computer and use it in GitHub Desktop.
Script to save a Screenshot
Param(
[String]$OutFilePath
)
Add-type -AssemblyName System.Drawing
$VirtualScreen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Bmp = New-Object System.Drawing.Bitmap $VirtualScreen.Width, $VirtualScreen.Height
$Graphic = [System.Drawing.Graphics]::FromImage($bmp)
$Graphic.CopyFromScreen($VirtualScreen.Left, $VirtualScreen.Top, 0, 0, $Bmp.Size)
$Bmp.Save($OutFilePath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment