Announcement

Collapse
No announcement yet.

Psloggedon Help

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

  • Psloggedon Help

    Does anyone know how to run Psloggedon for more then 1 specific PC at a time? But not the whole domain...lets say 40 PC's from a text file?

  • #2
    Re: Psloggedon Help

    The following is based on you creating an excel spreadsheet containing a list of your computer names that is saved to C:\workstations.xls. You computer names should be listed in Column A. The psloggedon utility will pipe the output from each query to the text file C:\results.txt. Save the below as .vbs file extension.

    Code:
    On Error Resume Next
    Set objExcel = CreateObject("Excel.Application")
    Set objWorkbook = objExcel.Workbooks.Open("C:\workstations.xls")
    x = 1
    Do Until objExcel.Cells(x, 1).Value = ""
        If objExcel.Cells(x, 1).Value = "" Then
            Exit Do
        End If
        strComputer = objExcel.Cells(x, 1).Value 
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run("psloggedon.exe >>C:\results.txt")
    x = x + 1
    Loop
    objWorkbook.Close
    objExcel.Quit
    I have not tested this but this should work.
    MCSA 2000/2003

    Comment


    • #3
      Re: Psloggedon Help

      Hmm...didn't work. But I'll work with it, thanks.

      Comment


      • #4
        Re: Psloggedon Help

        Code:
                          ''''''''
        errorReturn = WshShell.Run("%Comspec% /c ""D:\PSTOOLS\psloggedon.exe"" \\" & strComputer & " >>""C:\Results.txt""", 0, True)
                          ''''''''
        Last edited by Rems; 21st November 2007, 18:30.

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment


        • #5
          Re: Psloggedon Help



          Yeah it needed the "//" ...I was still having trouble but I needed to run it from the DC. Thanks guys.

          Edit* Actually, I'm getting a blank text file...
          Last edited by ekrengel; 21st November 2007, 17:45. Reason: text file blank

          Comment


          • #6
            Re: Psloggedon Help

            Edit* Actually, I'm getting a blank text file...
            Use %comspec% /c in the commandline, bcause it needs to be runned from a command-Prompt to be able to pipe the output to a file.
            And WaitOnReturn must be True, otherwise the file could still be open when the next computer is processed (see my example).
            (The parameter 0 = 'run hidden', 1 = 'run visible'. The next parameter is False or True = 'WaitOnReturn')

            it needed the "//"
            actually that is \\


            \Rems
            Last edited by Rems; 21st November 2007, 18:26. Reason: about the parameters

            This posting is provided "AS IS" with no warranties, and confers no rights.

            __________________

            ** Remember to give credit where credit's due **
            and leave Reputation Points for meaningful posts

            Comment


            • #7
              Re: Psloggedon Help

              Oops typo! Yeah I meant "\\"

              I have all the options you suggested...and it still has a blank text file:

              Code:
              'On Error Resume Next
              Set objExcel = CreateObject("Excel.Application")
              Set objWorkbook = objExcel.Workbooks.Open("C:\Documents and Settings\ekrengel\Desktop\PSloggedOn\workstations.xls")
              x = 1
              Do Until objExcel.Cells(x, 1).Value = ""
                  If objExcel.Cells(x, 1).Value = "" Then
                      Exit Do
                  End If
                  strComputer = objExcel.Cells(x, 1).Value
              Set WshShell = WScript.CreateObject("WScript.Shell")
              errorReturn = WshShell.Run("%comspec% /c C:\Documents and Settings\ekrengel\Desktop\PSloggedOn\psloggedon.exe \\" & strComputer & " >>C:\Results.txt", 0, True)
              x = x + 1
              Loop
              objWorkbook.Close
              objExcel.Quit
              
              msgbox "script complete!"
              
              Wscript.Quit(0)

              Comment


              • #8
                Re: Psloggedon Help

                Aah spaces in the path.
                The command is runned in a DOS environment, and does not support spaces in names, unless you put the path between quotes.
                In my example I now added double set of quotes around every path.
                (Because in the script there are qoutes around strings, you must use double sets of quotes (or use the ascii-code: chr(34) ))


                \Rems

                This posting is provided "AS IS" with no warranties, and confers no rights.

                __________________

                ** Remember to give credit where credit's due **
                and leave Reputation Points for meaningful posts

                Comment


                • #9
                  Re: Psloggedon Help

                  Ahaha yes! That's it...doh I've ran into that before. Oh well. Thanks for the help.

                  Comment

                  Working...
                  X