如何找到使用 mstsc 的时间以及由谁使用? [英] How to find amount of time mstsc is used and by whom?

查看:78
本文介绍了如何找到使用 mstsc 的时间以及由谁使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的团队地理位置分散,他们将使用远程桌面连接许多虚拟机.我想知道谁在访问远程桌面会话以及使用了多长时间.

Our team has geographically dispersed and many virtual machine will be connected by them using remote desktop. I would like to find who is accessing a remote desktop session and how long it is being used.

我试着用powershell来做.我写了一个脚本,用户将在其中使用 powershell 调用 mstsc.它将记录谁已登录以及何时登录.但我想知道何时有人从 mstsc 注销或断开 mstsc .有没有办法使用powershell在日志文件中捕获该信息.关闭 mstsc 时是否会触发可用于它的事件?

I tried to do it with powershell. I wrote a script where user will invoke mstsc using powershell. It will log who has logged in and when he logged. But i would like to find when some one log off from mstsc or disconnect mstsc . Is there any way to capture that information in log file using powershell. Whether any event will be triggered while closing mstsc which could be used for it?

推荐答案

我写了一个 PowerShell 模块,PSTerminalServices (http://psterminalservices.codeplex.com),它建立在 Cassia 之上.这是一个示例命令输出:

I wrote a PowerShell module,PSTerminalServices (http://psterminalservices.codeplex.com), that is built on Cassia. Here's a sample command output:

PS> Get-TSSession | fl *

IPAddress          :
State              : Active
ApplicationName    :
Local              : False
RemoteEndPoint     :
InitialProgram     :
WorkingDirectory   :
ClientProtocolType : Console
ClientProductId    : 0
ClientHardwareId   : 0
ClientDirectory    :
ClientDisplay      : Cassia.Impl.ClientDisplay
ClientBuildNumber  : 0
Server             : Cassia.Impl.TerminalServer
ClientIPAddress    :
WindowStationName  : Console
DomainName         : homelab
UserAccount        : homelab\shay
ClientName         :
ConnectionState    : Active
ConnectTime        : 12/15/2011 2:47:02 PM
CurrentTime        : 12/23/2011 4:35:21 PM
DisconnectTime     :
LastInputTime      :
LoginTime          : 12/15/2011 3:11:58 PM
IdleTime           : 00:00:00
SessionId          : 1
UserName           : shay

这篇关于如何找到使用 mstsc 的时间以及由谁使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆