Usernames on computers

November 16, 2009 at 08:09:27
Specs: Windows XP
I am trying to write a small messaging program to use across my network. I can send a message to a computer, but I was wondering if there was a way to know who was logged on to which computer? FOr example, how could I find out who was logged into computer E0000 on the network SERVER1?

See More: Usernames on computers

Report •

November 16, 2009 at 23:11:24
the only way I know is to have the remote run a client-side registry dump of key HKLM\Network\Logon and pull the data from key "username". I'm sure there are better ways but i don't know them. Also, that only applies to winME, so I'm not sure where winXP puts it in the registry. (Run regedit and search for your own username, note where it appears, log off and relog as diff. user and look for that username etc.)
client-side batch script:

reg export test "HKLM\Network\Logon"
copy test \\myserver\workdir\whois

serverside script:
for /f "tokens=1-3" in (workdir\whois) do (
if /i "%%~a" equ "username" (
set user=%%~c
goto ok)
echo %user%

this is very rough sketch, my Xp klunker just crapped out so i can't test anything.

Report •

November 17, 2009 at 00:55:24
I can't test it because I don't have a network, but does "net session" or "net session \\computername" list what your after?

Batch Variable how to

Report •

Related Solutions

Ask Question