JSI Tip 9556. Who is logged onto the console of computers in my network that are NOT computers in my logged-on domain?

Using the NET VIEW command, and Psloggedon freeware, I scripted WND.bat to report which computers that are NOT in my logged-on domain have local users logged on.

NOTE: See tip 9555 ยป How can a script return the domains and workgroups on my network?

The syntax for using WND.bat is:


The output is displayed on the console, in a CSV format:

"Domain Or Workgroup","Computer Name","User Name"



WND.bat contains:

@echo off
for /f "Skip=3 Tokens=*" %%d in ('net view /DOMAIN^|FIND /V "The command"^|FIND /V /I "%USERDOMAIN%"') do (
 for /f "Tokens=1" %%x in ('@echo %%d^|FIND /V "The command"') do (
  for /f "Tokens=1" %%c in ('net view /DOMAIN:%%d ^|FIND "\\"') do (
   set usr=%%c
   set usr=!usr:\=!   for /f "Tokens=*" %%u in ('PsLoggedOn -L -X %%c^|FINDSTR /I "!usr! %%d"') do (
    @echo "%%x","%%c","%%u"

Hide 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.