none
Help needed related to Batch Script. RRS feed

  • Question

  • I have made a batch script to query logged on users on remote computers and it is working fine but i want custome output from the script

    Cmd:

    for /f "Tokens=1-6 delims=  Skip=1" %i in (ServerList.txt) do (echo %i && query user /SERVER:%i)

    Output:

    C:\>(echo *******DC08-09   && quser /SERVER:*******DC08-09 )
    *******DC08-09
     USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
     nitesh1.parmar        rdp-tcp#0          12  Active          .  3/26/2018 5:04AM

    I need only following fields in the output

    USERNAME, STATE, IDLE, & LOGON TIME

    Can somebody help with the required output?

    • Moved by Bill_Stewart Wednesday, May 30, 2018 6:41 PM This is not "scripts on demand"
    Tuesday, March 27, 2018 9:44 AM