I want to know all the users logged in for a particular domain by executing a script. Kindly help me giving the script or command.
Thanks in advance.
I want to know all the users logged in for a particular domain by executing a script. Kindly help me giving the script or command.
Thanks in advance.
This solution works in my environment. We have login scripts that map network drives for every user. If I need to know who's logged in, I just go look at the "shared folders" snap-in on the server that hosts the share(s). Hit the "Sessions" tab; it shows all the logged in users right there.
You sound like you need something recorded maybe. Part of our login script is a command that writes the login/logoff date and time to a file on a network share. This is an append and each user has a file. Still probably not what your looking for, but it works great on my small network of ~25 users. Here's my script:
net time \\server1 /set /yes
ECHO %USERNAME% logged on %COMPUTERNAME% on %DATE% at %TIME% >>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
echo %USERNAME% logged on %COMPUTERNAME% on %DATE% at %TIME% >>\\apvdbs03\Public\Computers\%COMPUTERNAME%_Users.txt 2>&1
echo This syncs time to server 1 and maps the drives:>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
echo In order: U, S, T and V are now deleted:>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use U: /delete /y>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use S: /delete /y>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use T: /delete /y>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use V: /delete /y>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
echo In order: U, S, T and V are now mapped:>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use U: \\server1\users$\%username% /persistent:no>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use S: \\server1\Operations /persistent:no>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use T: \\server1\CommonFiles /persistent:no>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
net use V: \\server1\LM2001$ /persistent:no>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1
echo *****************************************END OF LOG ENTRY*********************************************>>\\apvdbs03\Public\Users\%USERNAME%.txt 2>&1