use*_*724 5 windows remote-desktop event-log event-viewer
有没有办法知道远程控制系统的系统名称?从日志中,我们能够知道用户名(但这些是通用登录 ID)和 IP(但我们使用的是 DHCP,这些每天都在变化)。
在左侧的事件查看器树中,应用程序和服务日志-> Windows ->终端服务-*,其中 * 是那里的所有日志。在终端服务本地会话管理器操作日志中,我们仅获取 IP 地址和用户名的详细信息。
是否有任何日志可以找到系统名称?
好吧,它开始了......(这并不容易;)
首先启用审计在secpol.msc。
我发现这是必需的,因为其他事件触发得太早而无法获取主机名。
secpol.msc然后单击enter。Local Policy>Audit PolicyAudit account logon events策略选项并选择Properties。Success框(失败的尝试不会以这种方式记录)secpol.msc现在创建一个 VBScript 文件(例如称为c:\temp\log.vbs):(
同时编辑所需日志文件的位置,在这里c:\temp\rdp.log)
Function sessionNumber
Dim oShell, oExec, sOutput, iUserPos, iUserLen, iStatePos
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec("query session %username%")
sOutput = LCase(oExec.StdOut.ReadAll)
iUserPos = InStr(sOutput,LCase(oShell.ExpandEnvironmentStrings("%username%")))
iStatePos = InStr(sOutput,"active")
iUserLen = Len(oShell.ExpandEnvironmentStrings("%username%"))
sessionNumber = CInt(Trim(Mid(sOutput,iUserPos+iUserLen,iStatePos-iUserPos-iUserLen)))
End Function
Function clientName
Dim oShell
Set oShell = CreateObject("WScript.Shell")
On Error Resume Next
clientName = LCase(oShell.RegRead("HKCU\Volatile Environment\"&sessionNumber&"\CLIENTNAME"))
If Err.Number<>0 Then
clientName = "unknown"
End If
End Function
outFile="c:\temp\rdp.log"
Const ForAppending = 8
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.OpenTextFile(outFile,ForAppending,True)
objFile.Write now() & " ; " & clientName & vbCrLf
objFile.Close
Run Code Online (Sandbox Code Playgroud)
现在为最后一部分创建一个计划任务来启动这个脚本。
taskschd.msc然后单击enter。Create Task在右侧窗格中选择Logon RDP或其他东西On an eventSecurity并在“事件 ID”中输入4624cscript.exe和添加参数类型中c:\temp\log.vbs现在,当有人通过 RDP 登录时,他们的主机名已登录 c:\temp\rdp.log
请注意,本地登录也会被记录(我还没有测试过,因为我在远程:)
但我想这不是问题。
您当然可以调整log.vbs以包括用户名、远程 IP 等。
(pfew,Windows XP 要容易得多。那个只是在事件中记录主机名)
也许有人可以想出一个更简单的解决方案:)

编辑:
我还发现在安全事件日志中有事件 ID 4624。查找带有Logon Type: 3. 它应该包含Workstation Name通过 RDP 登录的机器的 。
An account was successfully logged on.
Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0
Logon Type: 3
New Logon:
Security ID: User-PC\User
Account Name: User
Account Domain: User-PC
Logon ID: 0xcd5c10
Logon GUID: {00000000-0000-0000-0000-000000000000}
Process Information:
Process ID: 0x0
Process Name: -
Network Information:
Workstation Name: XPS8500
Source Network Address: -
Source Port: -
Run Code Online (Sandbox Code Playgroud)
编辑 #2
这是来自完全干净的 Windows 7 安装。
(主机是Test-pc我登录的机器XPS8500):

| 归档时间: |
|
| 查看次数: |
31756 次 |
| 最近记录: |