aqui está uma solução que também leva a captura de tela. Eu estou usando isso em meus scripts, onde eu preciso fazer o screenshot de algo. por que automatizar apenas partes da tarefa, quando você também é capaz de automatizar tudo ;-), certo?
# Take Screenshot function - reads width and height from WMI, saves in outfile path
function Take-Screenshot([string]$outfile)
{
[int]$PrtScrnWidth = (gwmi Win32_VideoController).CurrentHorizontalResolution
[int]$PrtScrnHeight = (gwmi Win32_VideoController).CurrentVerticalResolution
$bounds = [Drawing.Rectangle]::FromLTRB(0, 0, $PrtScrnWidth, $PrtScrnHeight)
$bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height
$graphics = [Drawing.Graphics]::FromImage($bmp)
$graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
$bmp.Save($outfile)
$graphics.Dispose()
$bmp.Dispose()
}
# Minimize all the Windows
$shell = New-Object -ComObject "Shell.Application"
$shell.minimizeall()
#sleep to make sure not to screenshot while everything is still minimizing
sleep -s 2
# Take the Screenshot - choose your outfile path
Take-Screenshot -outfile C:\Batch\test4.png
# get your screen back
$shell.undominimizeall()