通过cmd脚本记录Windows远程桌面用户登录日志
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过cmd脚本记录Windows远程桌面用户登录日志相关的知识,希望对你有一定的参考价值。
@echo off if "%1" == "h" goto begin mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit :begin set port=3389 set checkInterval=2 set prev="" :loop set curr= for /f "delims=" %%i in (‘netstat -n -p tcp ^|find ^":%port%^"‘) do (set curr=%%i) if not "%curr%"=="%prev%" ( set prev=%curr% date /t >>RDPlog.txt time /t >>RDPlog.txt echo %curr% >>RDPlog.txt ) ping -n %checkInterval% 127.1>nul goto :loop
远程桌面服务端口(port)为3389;
目前轮询频率(checkInterval)设置为2秒;
脚本运行后在后台,看不到Console窗口,当检测服务端口连接状态有变化时,会把时间和对方IP记录到RDPlog.txt中。
脚本设置为开机自启动就行了。
本文出自 “zl1030的记录” 博客,请务必保留此出处http://zl1030.blog.51cto.com/274507/1925247
以上是关于通过cmd脚本记录Windows远程桌面用户登录日志的主要内容,如果未能解决你的问题,请参考以下文章
CentOS系列001:windows远程桌面连接CentOS
远程连接windows系统提示:其他用户要远程登录,需要通过远程桌面服务进行登录的权限...