Announcement

Collapse
No announcement yet.

How do I tell which PC a user is logged onto?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I tell which PC a user is logged onto?

    Is there a way to tell which PC a user is logged onto? If not, can anyone recommend a product that does this.

    thanks,

    Scott

  • #2
    Re: How do I tell which PC a user is logged onto?

    I found a way to do this using Hyena. This technique uses the NBTSTAT command. The command

    NBTSTAT -a NetBIOS name

    will return the name of the user who is logged onto the PC in question. Note: in the above command "-a" is case-sensitive. For example,

    NBTSTAT -a Pete'sPC

    will return the name of the user (if any) who is logged onto the PC named Pete'sPC.

    The NBTSTAT command returns other data about the PC, so you have to use the "FIND" command to filter out the extra data.

    Here's how to use Hyena to find any PCs which a given user is logged onto:

    1. Get the names of the PCs that you want to search into Hyena's right hand pane. You probably want to limit this to "online" PCs to make the command run faster.

    2. Select (highlight) the PCs.

    3. From Hyena's Menu bar, select Tools, Generate Macro.

    4. Enter the following in the Macro Command String window:

    nbtstat -a %C1% | find /I "%1" && echo %1 is logged onto %C1% >> founduser.txt

    (All on one line, no matter how it appears here) Note: the "double ampersand" && command causes the echo command to execute only if the FIND is successful.

    5. Save this as a .bat file (finduser.bat, say).

    6. Run the batch file with the name of the user as a parameter, e.g.,

    finduser.bat Jdoe

    If user Jdoe is logged onto any PC, the file founduser.txt will show the name of the PC. I ran this batch file on about 200 PCs. It took about 4 minutes to run.

    Hope you find this useful.

    Comment


    • #3
      Re: How do I tell which PC a user is logged onto?

      Pete:

      Thanks for your help. I tried your solution and it does not seem to work and the directions are a little hazy.

      I pasted your line into Hyena in the generate macro window and saved it as a .BAT file. I then selected the computers and then went to RUN to run the macro. it does not save the output file to a txt file sometimes. the file also does not display the username only %1.

      thanks,

      Scott
      <div class="ubbcode-block"><div class="ubbcode-header">Quote:</div><div class="ubbcode-body">Originally posted by Pete Klimek:
      <span style="font-weight: bold">I found a way to do this using Hyena. This technique uses the NBTSTAT command. The command

      NBTSTAT -a NetBIOS name

      will return the name of the user who is logged onto the PC in question. Note: in the above command "-a" is case-sensitive. For example,

      NBTSTAT -a Pete'sPC

      will return the name of the user (if any) who is logged onto the PC named Pete'sPC.

      The NBTSTAT command returns other data about the PC, so you have to use the "FIND" command to filter out the extra data.

      Here's how to use Hyena to find any PCs which a given user is logged onto:

      1. Get the names of the PCs that you want to search into Hyena's right hand pane. You probably want to limit this to "online" PCs to make the command run faster.

      2. Select (highlight) the PCs.

      3. From Hyena's Menu bar, select Tools, Generate Macro.

      4. Enter the following in the Macro Command String window:

      nbtstat -a %C1% | find /I "%1" && echo %1 is logged onto %C1% >> founduser.txt

      (All on one line, no matter how it appears here) Note: the "double ampersand" && command causes the echo command to execute only if the FIND is successful.

      5. Save this as a .bat file (finduser.bat, say).

      6. Run the batch file with the name of the user as a parameter, e.g.,

      finduser.bat Jdoe

      If user Jdoe is logged onto any PC, the file founduser.txt will show the name of the PC. I ran this batch file on about 200 PCs. It took about 4 minutes to run.

      Hope you find this useful.</span></div></div>

      Comment


      • #4
        Re: How do I tell which PC a user is logged onto?

        Scott,

        Sorry this isn't working for you. Make sure that you're carrying out the steps from my original post in the order they were given. You need to select the computers before going into the Generate Macro window. If you go into the Generate Macro window first, the batch file you create won't work.

        Let me know if you have any questions about the instructions. Sorry that they weren't clear.

        Pete

        Comment


        • #5
          Re: How do I tell which PC a user is logged onto?

          I tried it again and this is the output I got:


          nbtstat -a VER007 | find /I "%1" && echo %1 is logged onto VER007 >> founduser.txt


          nbtstat -a VER008 | find /I "%1" && echo %1 is logged onto VER008 >> founduser.txt


          nbtstat -a XMM | find /I "%1" && echo %1 is logged onto XMM >> founduser.txt


          nbtstat -a XMM1 | find /I "%1" && echo %1 is logged onto XMM1 >> founduser.txt


          nbtstat -a ZEUS | find /I "%1" && echo %1 is logged onto ZEUS >> founduser.txt

          As you can see it is checking the PC's but not returning username. Any thoughts? I am trying to figure out where the %1 comes into play.

          thanks,

          Scott

          Comment


          • #6
            Re: How do I tell which PC a user is logged onto?

            Scott,

            You now should have a file named "finduser.bat". This batch file should consist of the lines quoted in your last message:

            nbtstat -a VER007 | find /I "%1" && echo %1 is logged onto VER007 >> founduser.txt


            nbtstat -a VER008 | find /I "%1" && echo %1 is logged onto VER008 >> founduser.txt

            etc.

            Open a command prompt, change to the folder in which finduser.bat is located, and enter the following command:

            finduser.bat username

            where username is the name of the user in question. The %1 is what's called a "replaceable parameter". When the batch file executes, the %1 will be replaced with the username.

            Hope this now works for you.

            Pete

            Comment

            Working...
            X