psloggedon timeout

Posted on

psloggedon timeout – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about windows, pstools, , , .

I have a list of machine names from my network that I have put in a batchfile to run through the list and show me who is logged onto each.

psloggedon \machineA
psloggedon \machineB
psloggedon \machineC
psloggedon \machineD
psloggedon \machineE
psloggedon \machineF
...

Psloggedon works fine, however when it hits a machine that isnt actually on the network, it hangs for a good 30 – 60 seconds before moving onto the next machine…I was just wondering if there was any way to speed this up so that if it hits a machine that isnt on the network, it moves onto the next machine in the list much quicker.

I have read in other places that this could be possible by adding a ping -n loop into the command… but how?

Solution :

In your case it would be the right thing do use ping command.

Start.cmd

FOR /F %%x in (c:temppclist.txt) do call ping_psloggedon.cmd %%x

ping_psloggedon.cmd

ping -n 1 -i 200 -w 130 %1
if errorlevel 1 goto exit
c:temppstoolspsloggedon.exe \%1
:exit

pclist.txt

PCNAME1
PCNAME2
PCNAME3

I dont know a way to do that in Dos.
Put you can use Autoit to get a “clear” list. http://www.autoitscript.com

Install Autoit then you can use this script.
You have to use newest psloggedon.exe (1.34)

Save the script as “NAME.au3” (NAME what ever you want) file.

Example:

c:NAME.au3
c:pclist.txt
c:pstoolspsloggedon.exe

#include <Constants.au3>
Dim $line, $line2, $file, $icount, $reg, $reg2, $reg3
$file = FileOpen("pclist.txt", 0)
While 1
$line = FileReadLine($file)
If @error Then ExitLoop
$reg3 = ""
$reg2 = ""
$reg = ""
If Ping($line, 200) Then
$reg = @ComSpec & ' /C "' & @ScriptDir & "pstoolspsloggedon.exe -l -x \" & $line & '"'
$reg = Run($reg, "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
While 1
$reg2 = StdoutRead($reg)
If @error Then ExitLoop
If $reg2 Then
$reg3 &= $reg2
EndIf
WEnd
If StringInStr($reg3, "Error") Then
$reg = "Error"
ElseIf StringInStr($reg3,"No one is logged") Then
$reg = "No one is logged on locally."
Else
$reg = StringTrimLeft($reg3, StringInStr($reg3, Chr(13), "", 3))
$reg = StringTrimLeft($reg, StringInStr($reg, ""))

Leave a Reply

Your email address will not be published.