JSI Tip 9400. Which domain users are currently logged onto the consoles of domain computers?

Using the NET VIEW command, and Psloggedon freeware, I scripted DULO.bat to report which domain users are logged onto the desktops of domain computers.

DULO.bat has no parameters. It displays the computer name and user name of all domain users currently logged on to the same domain as the user running DULO.bat from their workstation.

DULO.bat contains:

@echo off
setlocal
for /f "Tokens=1" %%c in ('net view /domain:"%USERDOMAIN%"^|Findstr /L /C:"\\"') do (
 for /f "Tokens=*" %%u in ('PsLoggedOn -L %%c^|find /i "%USERDOMAIN%\"') do (
  call :report %%c "%%u"
 )
)
endlocal
goto :EOF
:report
set work=%1
set comp=%work:~2%
set user=%2
set user=%user:"=%
call set user=%%user:*%USERDOMAIN%\=%%
@echo %comp% %user%



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish