You need to enable JavaScript to run this app. 局域网远程设备无感知截屏且不中断用户会话解决方案求助
优惠活动
大模型
产品
解决方案
定价
更多

局域网远程设备无感知截屏且不中断用户会话解决方案求助

远程主机无感知截屏需求及问题

任务背景

我是某IT公司新任系统信息管理员,上级分配的任务为:对同一局域网内的远程主机进行无感知截屏,且全程不得中断目标用户的当前会话。目前我正在寻找可实现该需求的第三方工具(免费、付费均可)或对应PowerShell脚本,以下是我目前的推进进度:

现有方案梳理

本地端截屏存储脚本

$Path = "C:\Users\Naskez\Desktop\Screenshots"
If (!(test-path $path)) {
New-Item -ItemType Directory -Force -Path $path
}
Add-Type -AssemblyName System.Windows.Forms
$screen = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds

$image = New-Object System.Drawing.Bitmap($screen.Width, $screen.Height)

$graphic = [System.Drawing.Graphics]::FromImage($image)
$point = New-Object System.Drawing.Point(0, 0)
$graphic.CopyFromScreen($point, $point, $image.Size);
$cursorBounds = New-Object System.Drawing.Rectangle([System.Windows.Forms.Cursor]::Position, [System.Windows.Forms.Cursor]::Current.Size)

[System.Windows.Forms.Cursors]::Default.Draw($graphic, $cursorBounds)
$screen_file = "$Path\" + $env:computername + "_" + $env:username + "_" + "$((get-date).tostring('yyyy.MM.dd-HH.mm.ss')).png"

$image.Save($screen_file, [System.Drawing.Imaging.ImageFormat]::Png)

远程主机用户会话ID获取脚本

若要从RDS服务器(或允许多并发RDP连接的Windows桌面设备)获取桌面截图,需先获取远程计算机上的用户会话ID,可通过如下PowerShell脚本指定远程计算机/服务器名称和用户账户:

$ComputerName = "nld-rds1"
$RDUserName = "h.jansen"
$quser = (((query user /server:$ComputerName) -replace '^>', '') -replace '\s{2,}', ',' | ConvertFrom-Csv)
$usersess=$quser | where {$_.USERNAME -like $RDUserName -and $_.STATE -eq "Active"}
$usersessID=$usersess.ID

远程执行截屏命令

最后通过携带正确sessionID的PsExec命令执行脚本:

.\PsExec.exe -s -i $usersessID \\$ComputerName powershell.exe -executionpolicy bypass -WindowStyle Hidden -file "\\nld-fs01\Screen\CaptureLocalScreen.ps1"

待解决问题

我司不允许多个RDP连接同时存在,执行上述方案时会导致目标用户会话被强制断开,恳请各位提供可行的解决方案或相关建议。

注:上述PowerShell方案非本人原创。

内容的提问来源于stack exchange,提问作者Naskez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.19 02:06:10