Question

So here's the dealio. I would like to create a simple batch file that'll create a log of each user that remotes in to a server. I know I can use

echo %username% > lastuser.log

but we all use the same username to log in to the server. I was wondering if it was possible to replace the "%username%" with some variable that'll return the physical computer that MSTSC is running on's name. I'd also like this to be a running list with the time of log in, but I can probably figure that out.

Was it helpful?

Solution

I believe you're looking for %CLIENTNAME%.

OTHER TIPS

I'll assume you want to do this on the server machine. I don't have MSTSC running at the moment, so I can't check this exactly, but suppose when a user logs in, the server does a netstat to see which remote machines have connections using the server on the MSTSC port. Would that work?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top