Added Screenshots
This commit is contained in:
parent
6aa57ebf71
commit
aee799326e
75
Login/Run-Screen.ps1
Normal file
75
Login/Run-Screen.ps1
Normal file
@ -0,0 +1,75 @@
|
||||
Add-Type @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class ScreenCapture {
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetDC(IntPtr hwnd);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
|
||||
|
||||
public static int GetScreenWidth() {
|
||||
IntPtr desktop = GetDC(IntPtr.Zero);
|
||||
int width = GetDeviceCaps(desktop, 118);
|
||||
ReleaseDC(IntPtr.Zero, desktop);
|
||||
return width;
|
||||
}
|
||||
|
||||
public static int GetScreenHeight() {
|
||||
IntPtr desktop = GetDC(IntPtr.Zero);
|
||||
int height = GetDeviceCaps(desktop, 117);
|
||||
ReleaseDC(IntPtr.Zero, desktop);
|
||||
return height;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
function Take-FullScreenshot {
|
||||
# Create directory if it doesn't exist
|
||||
$dirPath = "C:\Scripts\Screens"
|
||||
if (-not (Test-Path $dirPath)) {
|
||||
New-Item -ItemType Directory -Path $dirPath -Force | Out-Null
|
||||
}
|
||||
|
||||
# Clean up any existing screenshots in the directory
|
||||
Get-ChildItem -Path $dirPath -Filter "*.png" | Remove-Item -Force
|
||||
|
||||
# Get timestamp and set output path
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||
$outputPath = Join-Path $dirPath "screen_$timestamp.png"
|
||||
|
||||
# Get actual screen resolution
|
||||
$width = [ScreenCapture]::GetScreenWidth()
|
||||
$height = [ScreenCapture]::GetScreenHeight()
|
||||
|
||||
$bitmap = New-Object System.Drawing.Bitmap($width, $height)
|
||||
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
||||
|
||||
# Set high quality
|
||||
$graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
|
||||
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality
|
||||
|
||||
# Capture screen
|
||||
$graphics.CopyFromScreen(0, 0, 0, 0, $bitmap.Size)
|
||||
|
||||
# Save screenshot
|
||||
$bitmap.Save($outputPath, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
|
||||
$graphics.Dispose()
|
||||
$bitmap.Dispose()
|
||||
}
|
||||
|
||||
while ($true) {
|
||||
# Run the screenshot function
|
||||
Take-FullScreenshot
|
||||
# Wait 5 minutes
|
||||
Start-Sleep -Seconds 300
|
||||
}
|
||||
@ -36,6 +36,10 @@ powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\DefaultApp-ImageGlass
|
||||
:: Run Debloat Script
|
||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Software\Win11Debloat\Win11Debloat.ps1" -Silent -RemoveW11Outlook -DisableTelemetry -DisableBing -DisableSuggestions -DisableLockscreenTips -ShowKnownFileExt
|
||||
|
||||
:: Start Reoccurring Screenshot
|
||||
echo Running Screenshots... >> "%LOGFILE%"
|
||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Run-Screen.ps1"
|
||||
|
||||
:: Disable App Location Request Notification
|
||||
echo Disable App Location Request Notification... >> "%LOGFILE%"
|
||||
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Disable-AppLocationNotify.ps1"
|
||||
@ -63,4 +67,4 @@ echo Uninstall OneDrive... >> "%LOGFILE%"
|
||||
echo Script completed at %DATE% %TIME% >> "%LOGFILE%"
|
||||
echo Log file created at: %LOGFILE%
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user