I know this is an old post, but no external tools necessary for this (taking screenshot of remote PC without remoting on). Powershell only. See below:
Basically this will ask for a PC and user name. It will copy over a script (Screenshot_Desktop.ps1) to the temp directory of the remote PC and will then capture the correct session ID. It will then start the script on the remote pc and deposit the screenshot in the remote PC’s temp directory. There is a brief flash on the remote PC when screenshot it taken.
Script to trigger Screenshot_Desktop.ps1 below:
Write-Host “THIS ONLY WORKS IF SCREEN IS NOT LOCKED”
Write-Host " "
$ComputerName = Read-Host -Prompt ‘PLEASE ENTER PC NAME’
$UserName = Read-Host -Prompt ‘PLEASE ENTER USER ID’
Copies script to remote PC
copy-item “C:\Temp\SCREENSHOT_DESKTOP.ps1” “\$ComputerName\C$\Temp”
#Captures correct session ID
$results = psexec \$ComputerName query session
$id = $results | Select-String “$UserName\s+(\w+)” |
Foreach {$_.Matches[0].Groups[1].Value}
Allows script to execute on remote PC
psexec \$ComputerName POWERSHELL set-executionpolicy remotesigned
#Takes screenshot of remote PC
psexec -s -i $id \$ComputerName POWERSHELL -WindowStyle Hidden -file “C:\Temp\SCREENSHOT_DESKTOP.ps1”
######################################################
Screenshot_Desktop.ps1 script copied to remote PC from above:
$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
Create bitmap using the top-left and bottom-right bounds
$bitmap = New-Object System.Drawing.Bitmap $Width, $Height
Create Graphics object
$graphic = [System.Drawing.Graphics]::FromImage($bitmap)
Capture screen
$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
Save to file
$bitmap.Save($File)
Write-Output “Screenshot saved to:”
Write-Output $File
That’s it. Hope this helps people looking for a Powershell Only solution.