Results 1 to 13 of 13
  1. #1
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    When is a PC 'active'?

    I am trying to find a reliable and non-invasive* test which can be carried out remotely (from my machine or the server on a LAN) to determine when a PC can be considered to be 'active' or 'usable', that is, displaying the Logon Screen or the desktop and available to run programs remotely (using PSEXEC, say) after it has just been woken up from hibernation or standby, or has just been turned on.

    As I understand it, the usual method, PINGing the machine name or IP address and obtaining a valid "TTL=" message in response, only determines that the network adapter is active and not that the PC itself is 'usable' by programs. (Indeed, I remember occasions in the (distant!) past where PCs have been PINGable but have not even booted because a miscreant has left a floppy in the diskette drive!)

    Of course, waiting an undetermined number of seconds after the machine is PINGable would probably be sufficient for it to become 'active'/'usable', but we have a variety of PCs of different ages and speeds, and I would like a more absolute or definitive test.

    All creative thinking greatly appreciated!

    Thanks

    John

    * by 'non-invasive' I mean, just as an example, a trivial software program which could either be caused to run on the remote PC, or from my PC or the server could test the remote PC for 'runability'. In this context I consider that programs like PSINFO, PSEXEC, etc, are a bit too 'heavy'
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: When is a PC 'active'?

    Would something like running a BATch file on the remote PC which ran a NET SEND message back do the job?

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: When is a PC 'active'?

    That would be a possibility for the power-up situation, but how would you initiate it when the PC was returning from standby or hibernation? I'd prefer not using programs like PSEXEC or PSINFO if someone can think of a less 'heavy' method.

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  4. #4
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: When is a PC 'active'?

    I'm not sure I understand!

    Are you wanting to initiate the return from Standby or Hibernation remotely?

    "was returning from standby or hibernation" or "had returned from ...."?

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: When is a PC 'active'?

    John,

    The approach I usually take to problems of this sort is to assume that everything is fine and handle the errors by pausing / retrying as appropriate. You need to be able to handle the errors anyway, and this avoids any possible timing issues where your test shows available but...

    StuartR

  6. #6
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: When is a PC 'active'?

    Leif

    Yes, in this instance I will be sending a WakeOnLan magic packet to a standby'd or hibernated PC, and want to know at what point the PC has become active or usable.

    But the general question is how you can determine over the LAN when a PC has become active, given that PING simply indicates when the network adapter is active.

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  7. #7
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: When is a PC 'active'?

    Stuart

    My pseudo-code for this operation is

    For a specific PC
    do WakeOnLan
    set counter to some positive value like 27*
    :loop
    PING the PC one time
    if "TTL=" is returned, leave loop since PC is 'active' and go to do something
    decrement counter
    if counter still positive, goto loop
    if we reach here (after about 2 mins), the PC is probably powered off

    * Note: if PING finds the network adapter inactive, it seems to take 4.5 seconds, on my LAN at least, to return (as opposed to the 1 second interval between PINGing multiple times)

    Really I am asking for a 'better/different PING' which returns a positive answer when the PC is active or usable, rather than working off the network adapter...

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  8. #8
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: When is a PC 'active'?

    Run a DIR command until you get an acceptable response?

  9. #9
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: When is a PC 'active'?

    Leif

    Something has just clicked in my brain about your "NET SEND" comment!

    If I were to do <big>NET TIME pcname</big> I will either get the time back on the remote PC
    1. <LI>almost immediately, if it's active<LI>after a short delay, when it becomes active<LI>or give a time-out error response (system error 53) after 25-26 seconds, if it's powered off
    I just need to do some testing for #2, and to work out what other conditions could cause a timeout in #3.

    Of course there might be a better <big>NET something</big> than TIME, but that seems a good starting-point.

    Thanks to both of you!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  10. #10
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: When is a PC 'active'?

    <P ID="edit" class=small>(Edited by JohnGray on 20-Sep-06 11:45. PS added)</P>Leif

    Your DIR suggestion crossed with my initial testing of NET TIME, and the subsequent writeup.

    DIR <pcname>c$ seems to pause for around 21 seconds when <pcname> is hibernating, so that seems a feasible solution too.

    (Interestingly, very occasionally the error return for both commands is given within a few tenths of a second!)

    Thanks again

    John

    PS Further thoughts - I may also need to run this from a Domain User account rather than my own usual Domain Admin account, so an appropriate selection of a usable-by-everyone command needs to be investigated...!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  11. #11
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,568
    Thanks
    5
    Thanked 1,056 Times in 925 Posts

    Re: When is a PC 'active'?

    John,

    Here's a quote from Sysinternals Freeware - PsLoggedOn:

    "You can determine who is using resources on your local computer with the "net" command ("net session"), however, there is no built-in way to determine who is using the resources of a remote computer. In addition, NT comes with no tools to see who is logged onto a computer, either locally or remotely."

    So, it appears you'll have to be creative. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Joe
    Joe

  12. #12
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: When is a PC 'active'?

    Joe

    I'm not quite sure what you're saying there! I have no concern whether or not any user is logged on when the remote machine is hibernated or set to stand-by, and thus when it is awoken.

    Summarising my thoughts and today's testing:
    I need <UL><LI>a command that is initiated on the source computer (or the server) and runs on the remote (target) computer<LI>which can run from an ordinary user or Administrator or SYSTEM account, and gives the same and consistent results on all these (that rules out DIR, I'm afraid)<LI>that either waits until the remote computer becomes sufficiently active to run programs, or times out fairly rapidly<LI>that requires minimal resources[/list]PING is a start, because it tells you when/if the network adapter becomes active, and it seems to always work reliably (I've used it for ten years in this way!).

    If NET TIME remotecomputer can run, it works consistently for all accounts on the local machine. It usually times out after 25-26 seconds if the remote computer is inactive. BUT there are instances where it gives an error return almost instantly (fractions of a second) OR gives an error return when you might expect it to run successfully. I am investigating this, but I need to be able to see the screen of the PC being hibernated and woken up to know what is going on at the time.

    So I may well end up with PING followed by NET TIME, unless I can find a more reliable second program, or get to understand the vagaries of NET TIME better.

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  13. #13
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,568
    Thanks
    5
    Thanked 1,056 Times in 925 Posts

    Re: When is a PC 'active'?

    John,

    I guess I was equating user logon to availability. Oops. Have you checked out the various samples at Scripting? There appears to be many examples of querying remote computers.

    Joe
    Joe
    Joe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •