Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
Automation

How to Take Desktop Screenshots in PowerShell (PNG, Regions, Multiple Monitors, and Automation)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use .NET’s System.Drawing.Graphics.CopyFromScreen from PowerShell. It copies pixels from a screen rectangle into a bitmap, which you can save as PNG, JPEG, or another supported format. The script below captures the primary display, creates a timestamped PNG in your temporary folder, and releases its graphics resources even if saving fails.

Capture the primary display

Run this in Windows PowerShell or a PowerShell host that supports the Windows desktop APIs:

Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

$bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
$bitmap = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)

try {
    $graphics.CopyFromScreen(
        $bounds.Location,
        [System.Drawing.Point]::Empty,
        $bounds.Size
    )

    $path = Join-Path $env:TEMP ("screenshot-{0:yyyyMMdd-HHmmss}.png" -f (Get-Date))
    $bitmap.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
    Write-Output $path
}
finally {
    $graphics.Dispose()
    $bitmap.Dispose()
}

The command prints the complete file path after a successful save. Open it with Invoke-Item $path, or copy it elsewhere with Copy-Item. PNG is lossless and a sensible default for text, application windows, and diagrams.

Microsoft documents CopyFromScreen as performing “a bit-block transfer of color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics.” The bitmap is that drawing surface; the source point and size determine which pixels are copied.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

What each part of the script does

Load the Windows assemblies

System.Windows.Forms supplies screen information such as PrimaryScreen.Bounds. System.Drawing supplies Bitmap, Graphics, and image encoders. Add-Type loads those assemblies for the current session.

Choose a source rectangle

$bounds.Location is the upper-left source coordinate and $bounds.Size is its width and height. The destination point is Point.Empty, so pixels are written from the top-left of the new bitmap.

Save and clean up

Bitmap.Save writes the image using the selected encoder. The finally block disposes both .NET objects, preventing handles and memory from accumulating during repeated captures.

Capture a selected rectangle

For a fixed region, replace the screen bounds with explicit coordinates and dimensions. Coordinates are desktop pixels; the origin and any negative values depend on your monitor arrangement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Add-Type -AssemblyName System.Drawing

$x = 100
$y = 80
$width = 1200
$height = 700
$bitmap = New-Object System.Drawing.Bitmap $width, $height
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)

try {
    $graphics.CopyFromScreen(
        $x,
        $y,
        0,
        0,
        [System.Drawing.Size]::new($width, $height)
    )

    $path = Join-Path $env:USERPROFILE 'Picturesregion.png'
    $bitmap.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
    $path
}
finally {
    $graphics.Dispose()
    $bitmap.Dispose()
}

Make sure the rectangle lies within the visible desktop area. An invalid or inaccessible source can cause a .NET or Windows graphics exception rather than producing a useful image.

Capture every monitor in the virtual desktop

To include all attached displays, select the screen object marked as the primary screen and combine the monitor rectangles into one virtual bounding rectangle. This preserves negative coordinates when a monitor sits left or above the primary display.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

$screens = [System.Windows.Forms.Screen]::AllScreens
$left   = ($screens | ForEach-Object { $_.Bounds.Left }   | Measure-Object -Minimum).Minimum
$top    = ($screens | ForEach-Object { $_.Bounds.Top }    | Measure-Object -Minimum).Minimum
$right  = ($screens | ForEach-Object { $_.Bounds.Right }  | Measure-Object -Maximum).Maximum
$bottom = ($screens | ForEach-Object { $_.Bounds.Bottom } | Measure-Object -Maximum).Maximum

$width = $right - $left
$height = $bottom - $top
$bitmap = New-Object System.Drawing.Bitmap $width, $height
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)

try {
    $graphics.CopyFromScreen(
        [System.Drawing.Point]::new($left, $top),
        [System.Drawing.Point]::Empty,
        [System.Drawing.Size]::new($width, $height)
    )

    $path = Join-Path $env:USERPROFILE 'Picturesvirtual-desktop.png'
    $bitmap.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
    $path
}
finally {
    $graphics.Dispose()
    $bitmap.Dispose()
}

The resulting image is rectangular. If the monitors have different sizes or positions, unused areas between them can appear as background-colored gaps. Test the bounds on the exact multi-monitor and DPI configuration you support.

Choose PNG, JPEG, or another format

Pass a different encoder to Save and use a matching extension:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Format PowerShell expression Use it when
PNG [System.Drawing.Imaging.ImageFormat]::Png You need sharp text and lossless output.
JPEG [System.Drawing.Imaging.ImageFormat]::Jpeg A smaller photographic image is more important than perfect text.
BMP [System.Drawing.Imaging.ImageFormat]::Bmp You need an uncompressed bitmap and can accept a large file.

For JPEG quality control, create an encoder and set its quality property rather than relying on the default. PNG generally avoids that extra configuration.

Run a reusable screenshot function

A function makes repeated or scheduled captures easier and lets callers choose the output path and rectangle.

function Save-ScreenCapture {
    param(
        [Parameter(Mandatory)] [string] $Path,
        [int] $X = $null,
        [int] $Y = $null,
        [int] $Width = $null,
        [int] $Height = $null
    )

    Add-Type -AssemblyName System.Windows.Forms
    Add-Type -AssemblyName System.Drawing

    if ($null -eq $Width -or $null -eq $Height) {
        $source = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
        $X = $source.Left; $Y = $source.Top
        $Width = $source.Width; $Height = $source.Height
    }

    $folder = Split-Path -Parent $Path
    if ($folder -and -not (Test-Path $folder)) {
        New-Item -ItemType Directory -Path $folder -Force | Out-Null
    }

    $bitmap = New-Object System.Drawing.Bitmap $Width, $Height
    $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
    try {
        $graphics.CopyFromScreen($X, $Y, 0, 0,
            [System.Drawing.Size]::new($Width, $Height))
        $bitmap.Save($Path, [System.Drawing.Imaging.ImageFormat]::Png)
    }
    finally {
        $graphics.Dispose()
        $bitmap.Dispose()
    }
}

Save-ScreenCapture -Path (Join-Path $env:USERPROFILE 'Picturescapture.png')

Use an absolute path for unattended jobs. A relative path is resolved from the process’s working directory, which may differ between an interactive shell and Task Scheduler.

Schedule automatic captures

The capture API needs an interactive desktop. Configure a scheduled task to run only when the target user is logged on; a task running as noninteractive SYSTEM has no desktop screen to copy. This is guidance from a Microsoft Q&A answer, not a guarantee for every Windows configuration.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
  1. Save your script, for example as C:Scriptscapture.ps1.
  2. Open Task Scheduler and choose Create Task.
  3. On General, select the user account and choose Run only when user is logged on.
  4. On Triggers, add the schedule or event that should start the capture.
  5. On Actions, select Start a program. Use powershell.exe for Windows PowerShell, or the full path to pwsh.exe for PowerShell 7. Add arguments such as -NoProfile -ExecutionPolicy Bypass -File "C:Scriptscapture.ps1".
  6. On Conditions, remove power or idle restrictions that would prevent the required run.
  7. Run the task manually once while logged on and inspect the output directory and Task Scheduler history.

Compatibility and capture limitations

  • This is Windows desktop code. The available material does not establish a complete compatibility matrix for Windows PowerShell 5.1, PowerShell 7, modern .NET, or non-Windows systems, so verify the exact host you deploy.
  • Secure desktops, protected video, remote sessions, mixed-DPI monitors, and cursor inclusion can behave differently. Test those cases rather than promising that ordinary desktop capture will include them.
  • The API can report a Win32Exception. Record the host, coordinates, dimensions, and account when diagnosing one.
  • Large, high-resolution bitmaps consume memory proportional to width × height × color depth. Capture only the region you need for frequent jobs, and dispose objects after every image.

Troubleshooting

“Unable to find type” or missing assembly errors

Run the two Add-Type lines before creating screen or drawing objects. If the host is not Windows desktop-capable, this API is the wrong capture method; use a platform-appropriate tool instead.

The file is created but black or blank

Confirm that a user is logged on and the desktop is unlocked and visible. A noninteractive scheduled task, secure desktop, protected content, or remote-session policy can prevent ordinary pixels from being available.

Only one monitor appears

PrimaryScreen.Bounds intentionally captures one display. Use AllScreens and the virtual-desktop function for a combined image, or pass the coordinates of the specific monitor you want.

The image is cropped or shifted

Print the chosen rectangle and compare it with each monitor’s Bounds. Negative coordinates are normal when a monitor is positioned left or above the primary display. Mixed scaling requires validation on the actual machine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The scheduled task works manually but not on a timer

Check that the task uses the same account, executable, script path, working directory, and “Run only when user is logged on” setting as your successful manual test. Review Task Scheduler history and write errors to a log file.

Repeated captures slow down or exhaust memory

Dispose Graphics and Bitmap in a finally block, avoid unnecessarily large rectangles, and stagger captures instead of starting many simultaneous PowerShell processes.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If what you really need is a screenshot of a public web page rather than the pixels on your Windows desktop, ScreenshotNeo makes one GET request and returns PNG, JPEG, WebP, or PDF. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

See the parameter reference in the ScreenshotNeo documentation. The same endpoint can be called from PowerShell with Invoke-WebRequest:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$uri = 'https://api.screenshotneo.com/v1/shot?access_key=YOUR_API_KEY&url=https%3A%2F%2Fstripe.com'
Invoke-WebRequest -Uri $uri -OutFile 'shot.webp'

Equivalent requests are useful in mixed-language automation:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Every plan includes its features; the Free plan includes 1,000 shots per month with no card, and paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

Can this capture the mouse pointer?

The documented CopyFromScreen operation copies screen pixels; the available material does not establish guaranteed cursor inclusion. If the pointer matters, test the exact Windows configuration and consider a separate cursor-rendering step.

Can I capture a minimized window?

This method captures the visible desktop rectangle, not an off-screen or minimized window’s render surface. Bring the target content onto the visible desktop or use an application-specific automation API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where should I store screenshots from a long-running job?

Use a dedicated directory with an absolute path, a predictable naming scheme, and a retention policy. Ensure the task account has write permission and monitor disk usage.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Is PowerShell required for ScreenshotNeo?

No. ScreenshotNeo is an HTTP API, so any language or shell that can make a GET request can use it; the PowerShell, cURL, Python, and Node.js examples above all call the same endpoint.

Frequently Asked Questions

Can this capture the mouse pointer?

The documented CopyFromScreen operation copies screen pixels; guaranteed cursor inclusion is not established, so test your configuration or add a separate cursor-rendering step.

Can I capture a minimized window?

No. The method captures visible desktop pixels, not a minimized window’s off-screen render surface.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where should I store screenshots from a long-running job?

Use an absolute, writable directory, predictable names, and retention controls so disk usage remains bounded.

Is PowerShell required for ScreenshotNeo?

No. It is an HTTP API usable from PowerShell, cURL, Python, Node.js, or another HTTP client.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.