Logging the Windows Remote Desktop User logon log through a CMD script

Source: Internet
Author: User
Tags windows remote desktop

@echo offif "%1" = = "h" goto begin Mshta Vbscript:createobject ("Wscript.Shell"). Run ("%~nx0 h", 0) (window.close) && ; Exit:begin set Port=3389set checkinterval=2set prev= "": Loopset 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

The Remote Desktop Services port (ports) is 3389;

The current polling frequency (Checkinterval) is set to 2 seconds;

After the script runs in the background, the console window is not visible, and when the detection service port connection status changes, the time and the other IP are recorded in the RDPlog.txt.

The script is set to boot from the start on the line.

This article is from the "zl1030 Records" blog, so be sure to keep this source http://zl1030.blog.51cto.com/274507/1925247

Logging the Windows Remote Desktop User logon log through a CMD script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.