Find specific user account on multiple machines on the network

Posted on 2005-05-13
Last Modified: 2008-03-06
Is there any sort of script that will allow me to scan all machines on the network for a specific user account?
Question by:dabryantIT
    LVL 10

    Accepted Solution

    Set WshShell = WScript.CreateObject("WScript.Shell")
    sDomain       = "IDEAL"
    Set oDomain       = GetObject("WinNT://" & sDomain)
    oDomain.Filter       = Array("Computer")
    For Each oADobject In oDomain
          WScript.Echo oADobject.Name
          WshShell.Run "cmd /k psloggedon -d " & sDomain & " \\" & oADobject.Name & " >>c:\log.txt",1, true

    Psloggedon.exe can be found in the PSTools 2.1
    Psloggedon.exe /? for the syntax
    You can also use the redirection, the | pife followed by a Find command
    Psloggedon will check each PC's registry.
    When a PC is closed it will takes more time before checking the Next PC.
    Wscript.Echo can be removed from the script.
    LVL 7

    Expert Comment

    As said above - psloggedon. Just enter:

    psloggedon <username>

    Go get a coffee and it'll be done when you get back. If you have a lot of machines then you may want to go for lunch! It can be pretty slow. A better option is to track the user logons using the login script. Simply add the line

    @echo %USERNAME% logged onto %COMPUTERNAME% at %TIME% on %DATE% >> \\<server>\<public writeable share>\logons.txt

    Every logon is now tracked in the logons.txt file.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Read about the 3 stages of the buyer's journey: awareness, consideration, and decision.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now