Capture Current Desktop Session using Boot Diagnostics
You can do this with the RDP shadow function.
See https://support.microsoft.com/en-gb/help/292190/how-to-shadow-a-terminal-server-session-without-prompt-for-approval
To connect remotely you can use:
query session /server:[hostname-of-VM]
Then call the RDP client as follows:
mstsc.exe /v:[hostname-of-VM] /shadow:[id]
Capturing screenshots of a minimized remote desktop
You have to temporarily restore the window, capture, and minimize it again. This link shows how to do it silently
How to take a remote screenshot with Powershell
So I got this to work but it is a little involved. Works with multiple monitors.
You will need Screenshot.ps1
on the remote PC, your trigger script and PSExec on local PC (Google).
# This is Screenshot.ps1
# Add types and variables
$File = "C:\Temp\Screenshot1.bmp"
Add-Type -AssemblyName System.Windows.Forms
Add-type -AssemblyName System.Drawing
# Gather Screen resolution information
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Width = $Screen.Width
$Height = $Screen.Height
$Left = $Screen.Left
$Top = $Screen.Top
# Set bounds
$bitmap = New-Object System.Drawing.Bitmap $Width, $Height
# Create Object
$graphic = [System.Drawing.Graphics]::FromImage($bitmap)
# Capture
$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
# Save
$bitmap.Save($File)
And then for the trigger script
#Setup Variables
$ComputerName = "ComputerName"
$PSExec = "C:\temp\tools\psexec.exe"
# Captures session details
$quser = (((query user /server:$ComputerName) -replace '^>', '') -replace '\s{2,}', ',' | ConvertFrom-Csv)
# Takes screenshot of remote PC
&$PSExec -s -i $quser.ID "\\$ComputerName\" PowerShell -WindowStyle Hidden -File "C:\Temp\screenshot.ps1"
Related Topics
Accuracy of Textrenderer.Measuretext Results
How to Find the Parent Directory in C#
How to Draw a Rounded Rectangle in C#
C# Datetimes: Conversion for Different Time Zones
Sorting a Dictionary in Place with Respect to Keys
The 'Await' Operator Can Only Be Used Within an Async Lambda Expression
How to Change My New List Without Changing the Original List
Very Simple Definition of Initializecomponent(); Method
C# MACro Definitions in Preprocessor
Why am I Getting Sehexception When Calling Roleenvironment.Getconfigurationsettingvalue("Mykey")
Check If Datetime Instance Falls in Between Other Two Datetime Objects
How to Determine the True Pixel Size of My Monitor in .Net
How to Upload Files Using Ajax to ASP.NET MVC Controller Action
How to Add My New User Control to the Toolbox or a New Winform